method supports efficient upload of files using HTML5 features. In a load-balanced server farm without sticky sessions, this method must ensure that chunks of a file received by different servers are appended to the same physical file. To ensure this, the
method must leverage a
that implements an Append method. As of the time of this post, the only standard
that supports Append is
UploadChunk will work as follows:
- if the application setting
ScratchpadFileObject is not empty, then a file object matching
ScratchpadFileObject will be used
- otherwise, the first UNCFile-based
FileObject will be used
Once all the chunks have been appended to the scratchpad file, the application will call Attachment/Queue/MoveFile to move the file from the scratchpad to a 'final' repository (typically S3). Note that we queue this move, instead of executing it, so the user does not need to wait for a large files to be moved between repositories. A very large file move may result in an HTTP timeout.
If the file is accessed before the move happens, it is simply read from the scratchpad file object, as opposed to the 'final' repository.