Upload files with multipart/form-data is straight forward and works well most of time until you started to be focused on big files upload. If we look closely what happens during a file upload:
client sends POST request with the file content in BODY
webserver accepts the request and initiates data transfer (or returns error 413 if the file size is exceed the limit)
webserver starts to populate buffers (depends on file and buffers size), store it on disk and send it via socket/network to back-end
back-end verifies the authentication (take a look, once file is uploaded)
back-end reads the file and cuts few headers Content-Disposition, Content-Type, stores it on disk again back-end performs all you need to do with the file
To avoid such overhead we dump file on disk (Nginx client_body_in_file_only) and manage the callback to be send further down the line. Then queue worker picks the file up and do what required. It works for inter-server communication pretty slick but we have to solve similar problem with client side upload.
We also have client-side S3 upload solution. No back-end interaction happens. For video upload we manage the video to convert to the format h.264 Baseline / AAC with Zencoder.
Currently we use modified Flash uploader based on s3-swf-upload-plugin with combination of Zencoder JS SDK which is really efficient but uses Flash.
Question. How to reach the same goal with HTML5 file uploader? Does Filepicker.io and Zencoder solve the problem? What is the recommended way to manage HTML5 file upload with no back-end interaction?
The requirements are the following:
- HTML5, not flash
- to upload video with post-processing to make it compatible with HTML5 players and mobile
- to upload images wtih post-processing (resize, crop, rotate)
- to upload documents like PDF with a preview functionality
Does https://www.filepicker.com make a good job?
client_body_in_file_only
cause more disk access and thus decreased performance? The Nginx docs say it should be used for debugging primarily. – Aerophyte