Download the PHP package thingmabobby/file-upload-service without Composer

On this page you can find all versions of the php package thingmabobby/file-upload-service. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package file-upload-service

FileUploadService

A comprehensive PHP service for handling file uploads from base64 encoded data URIs or traditional file uploads ($_FILES array). Supports images, PDFs, CAD drawings, videos, and other common file types with pluggable storage backends, advanced security features, and flexible validation options.

Features

Minimum Requirements

Suggested Requirements

Installation

Basic Usage

Structured Successful Uploads

$result->successfulFiles remains an array of path/identifier strings for backward compatibility.

$result->successfulUploads contains FileUploadSuccess objects with input provenance and final processed-file metadata. Use this when you need original vs requested vs stored names, MIME type, size, or whether HEIC conversion actually produced the stored artifact.

Input vs output fields:

originalFilename is untrusted provenance metadata. It intentionally preserves the raw incoming $_FILES['name'] (or is null for base64/data-URI input, which has no intrinsic original filename). It may contain unsafe client-supplied text. Never use it as a filesystem path, stored filename, or Content-Disposition value, and never treat it as sanitized output. storedFilename is the package-produced logical/sanitized filename for the successfully processed artifact.

Traditional Usage (Backward Compatible)

Custom MIME Type Support

The service now supports custom MIME types and extensions beyond the predefined categories:

Using Constructor with MIME Types

Using Setter Methods

Mixed Configuration Example

Video File Support

The service now includes comprehensive video file support:

Exception Handling

The FileUploadService uses a two-tier exception handling strategy:

Critical Errors (Thrown Exceptions)

These errors prevent the entire operation from proceeding and should be caught with try-catch:

Individual File Errors (Captured in Result)

These errors affect individual files but allow the operation to continue:

Best Practice

Always wrap the save() method in a try-catch block to handle critical errors, then check the result for individual file errors:

Configuration

File Type Restrictions

HEIC/HEIF Conversion

The service automatically attempts to convert HEIC/HEIF files to JPEG format. If the conversion library is not available, it gracefully degrades by saving the original HEIC/HEIF file as-is.

HEIC Conversion Behavior:

On a successful conversion, FileUploadSuccess describes the JPEG output: storedFilename ends in .jpg, mimeType is image/jpeg, wasConverted is true, and originalFilename still records the incoming name (for example IMG_1234.HEIC). wasConverted is true only when conversion actually produced the stored artifact — not merely because conversion was enabled. Data-URI uploads have originalFilename === null.

Collision Resolution Strategies

High Performance Mode

Error Handling and Rollback

Storage Backends

Input Types

$_FILES Structure Handling

The service automatically detects and handles different $_FILES array structures:

Single File Upload:

Multiple File Upload:

Base64 Data URIs

Mixed Input Types

Supported File Types

The service supports a comprehensive range of file types through the SupportedFileTypesEnum. Here are all supported file types organized by category:

Images

Extension MIME Type Description
jpg image/jpeg JPEG images
png image/png PNG images
gif image/gif GIF images
webp image/webp WebP images
avif image/avif AVIF images
jxl image/jxl JPEG XL images
bmp image/bmp BMP images
tiff image/tiff TIFF images
heic image/heic HEIC images (converted to JPEG)
heif image/heif HEIF images (converted to JPEG)

Videos

Extension MIME Type Description
mp4 video/mp4 MP4 videos
avi video/x-msvideo AVI videos
mov video/quicktime QuickTime videos
wmv video/x-ms-wmv Windows Media videos
flv video/x-flv Flash videos
webm video/webm WebM videos
mkv video/x-matroska Matroska videos
mpeg video/mpeg MPEG videos
mpg video/mpeg MPEG videos
3gp video/3gpp 3GPP videos
m4v video/x-m4v iTunes videos
ogv video/ogg Ogg videos

PDF Documents

Extension MIME Type Description
pdf application/pdf Standard PDF documents
pdf application/x-pdf Alternative PDF MIME type
pdf application/acrobat Adobe Acrobat PDF
pdf application/vnd.pdf Vendor-specific PDF

Documents

Extension MIME Type Description
doc application/msword Microsoft Word documents
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document Microsoft Word XML documents
xls application/vnd.ms-excel Microsoft Excel spreadsheets
xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Microsoft Excel XML spreadsheets
ppt application/vnd.ms-powerpoint Microsoft PowerPoint presentations
pptx application/vnd.openxmlformats-officedocument.presentationml.presentation Microsoft PowerPoint XML presentations
txt text/plain Plain text files
rtf application/rtf Rich Text Format documents
csv text/csv Comma-separated values
xml application/xml XML documents
json application/json JSON documents
odt application/vnd.oasis.opendocument.text OpenDocument text
ods application/vnd.oasis.opendocument.spreadsheet OpenDocument spreadsheet
odp application/vnd.oasis.opendocument.presentation OpenDocument presentation

CAD Files

Extension MIME Type Description
dwg application/dwg AutoCAD drawings
dxf application/dxf AutoCAD DXF files
step application/step STEP 3D models
iges application/iges IGES 3D models
stl application/stl STL 3D models
sldprt application/sldprt SolidWorks part files
sldasm application/sldasm SolidWorks assembly files

Archives

Extension MIME Type Description
zip application/zip ZIP archives
rar application/x-rar-compressed RAR archives
7z application/x-7z-compressed 7-Zip archives
tar application/x-tar TAR archives
gz application/gzip GZIP compressed files

File Type Categories

The service organizes file types into the following categories (accessible via FileTypeEnum):

Note: For programmatic access to this information, use the SupportedFileTypesEnum class which provides methods to get extensions, MIME types, and categories for each supported file type.

Security Features

Path Traversal Protection

Filename Sanitization

MIME Type Validation

Atomic File Operations

Double Extension Protection

API Reference

FileUploadService

Constructor

Public Methods

File Management:

Configuration:

Status Checks:

Utilities:

Static Methods

FileUploadResult

Properties:

Methods:

FileUploadError

Properties:

Methods:

FileUploadSuccess

One successfully processed and saved upload. Filename fields are not aliases.

Properties:

Architecture

The service is built with a clean separation of concerns:

Storage Backend Interface

The service uses the FileSaverInterface to abstract file storage operations, allowing for different storage backends:

The interface provides methods for:

Testing

The package includes comprehensive test coverage with PHPUnit:

License

MIT - See LICENSE file for details.


All versions of file-upload-service with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
maestroerror/php-heic-to-jpg Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package thingmabobby/file-upload-service contains the following files

Loading the files please wait ...