A Silverstripe UploadField that supports (very) large uploads without fiddling with php.ini
Clone or download
Latest commit 6c83733 Dec 23, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_config Adding empty _config folder to git, fixes #1 Mar 3, 2015
code another fix to the validator to fool js validation Dec 20, 2016
images Adding screenshot Feb 9, 2015
.editorconfig Added standard .editorconfig file Dec 31, 2015
.scrutinizer.yml Added standard Scrutinizer config Feb 16, 2016
LICENSE Initial commit Feb 9, 2015
README.md Adding screenshot Feb 9, 2015
composer.json Initial commit Feb 9, 2015

README.md

silverstripe-chunkeduploadfield

A Silverstripe UploadField that supports (very) large uploads without fiddling with php.ini

Screenshot

The ChunkedUploadField hooks into the jQuery-File-Upload module used internally by the standard UploadField. It sets some extra config and hooks into the upload action to add support for uploading large files in chunks.

A video file upload example:

	$mp4field = ChunkedUploadField::create("MP4")->setTitle("MP4 File");
	$mp4field->getValidator()->allowedExtensions = array("mp4");
	$sizeMB = 500 * 1024 * 1024; // 500 MB in bytes
	$mp4field->getValidator()->setAllowedMaxFileSize($sizeMB);

By default, the chunk size is set to 90% of php's upload_max_filesize or post_max_size (whichever is smaller). It can be set to a different size:

	// send in chunks of 1 MB each
	$mp4field->setConfig('maxChunkSize', 1 * 1024 * 1024 );

##How do chunked uploads work?

The maxChunkSize is auto-set to ca 90% of the upload size permitted by PHP. The File Upload plugin splits up files with a file size bigger than maxChunkSize into multiple blobs and submits each of these blobs to the upload url in sequential order. After the full file has been received and reassembled, the upload handling is passed off to the regular UploadField.