5.16.2
This section of the tutorial is aimed at beginners looking to create their own upload server. Note that this example does not apply to S3 uploads. For more information on uploading to Amazon's Simple Storage Service, read the Fine Uploader S3 server documentation.
For this tutorial we are going to use PHP to develop a simple server which will accept uploads from our Fine Uploader instance.
If PHP is not your style, then feel free to browse the other server-side examples repository. It's quite important for you to read the traditional server-side integration instructions before you do any of this, though.
We've published a traditional endpoint PHP server for Fine Uploader to Packagist, which means you can easily download it to your project using composer!
Follow these simple steps to get a copy of the PHP traditional endpoint using Composer:
curl -sS https://getcomposer.org/installer | php
.php composer.phar install
.An example composer.json file may look like this:
{ "require": { "fineuploader/php-traditional-server": "1.1.0" } }
Be sure to update the version with the appropriate version of Fine Uploader's traditional PHP server.
Be sure to include a php.ini file in the root of your web server with sensible request limits. An example php.ini file looks like this:
upload_max_filesize = 10M post_max_size = 10M
You can easily start up a simple HTTP server using PHP. Run the following command in the root of your web server:
php -S 0.0.0.0:8080 -t . -c php.ini
The above command will spawn a server on port 8080.
Ensure all configuration options are pointing to the path of the downloaded traditional endpoint server. For example,
if you placed composer.json in the root of your web server, the path to your PHP server will be
/vendor/fineuploader/php-traditional-server/endpoint.php
. You'll need to be aware of this endpoint when setting
the request.endpoint
, deleteFile.endpoint
,
and chunking.success.endpoint
configuration options.
A typical configuration may look like this:
var manualUploader = new qq.FineUploader({ element: document.getElementById("fineuploader-container"), request: { endpoint: "/vendor/fineuploader/php-traditional-server/endpoint.php" }, deleteFile: { enabled: true, endpoint: "/vendor/fineuploader/php-traditional-server/endpoint.php" }, chunking: { enabled: true, concurrent: { enabled: true }, success: { endpoint: "/vendor/fineuploader/php-traditional-server/endpoint.php?done" } }, resume: { enabled: true }, retry: { enableAuto: true, showButton: true } });
You're all set! If you do run into any problems you can ask a question on Stack Overflow under the fine-uploader tag. Server example bugs should be reported in the php-traditional-server GitHub repository.