Class Banana.Controls.ChunkUpload
Defined in: ChunkedUpload.js.
Constructor Summary
new Banana.Controls.ChunkUpload
()
creates a chunked upload control currently only supported by limited amount of browsers: chrome and firefox.
Method Summary
setMultipleFilesUpload(bool)
processFileChunkFrom(file, index, cb)
Processes a chunk from a file this method is recalled everytime a chunk is completed.
getFile(filename)
uploadChunk(chunk, file, cb)
Uploads a chunk if a chunk fails we set uploadError on file object to true
Constructor Detail
new Banana.Controls.ChunkUpload()
creates a chunked upload control
currently only supported by limited amount of browsers: chrome and firefox.
uploads file is small chunks. the upload control ensures that chunks are send to the
server in the correct order. Server is responsible to reconstruct the chunks to one file
during file upload the first time a chunk is uploaded we append "firstChunk" to the post params
last time a chunk is uploaded we append "lastChunk" to the post params.
a "uid" param is appended to identify the file serverside
Method Detail
setChunkSize(chunkSize)
: this
set the size of a chunk. the lower you set the chunk, the lower memory usuage will be, but also
Parameters:
{int} | chunkSize |
Returns:
{this} |
setMaxSimultaneousUpload(maxSimultaneousUpload)
: this
max upload at the same time
Parameters:
{int} | maxSimultaneousUpload |
Returns:
{this} |
setMultipleFilesUpload(bool)
: this
Parameters:
{boolean} | bool | when true filedialog supports multiple file selection |
Returns:
{this} |
isSupported()
: boolean
Check whether our upload control is supported by the browser
Returns:
{boolean} |
registerCustomEvents()
Here we listen to the fileupload event.
we create a construction here to use maxSimultaneousUpload and
ensure completion of all files
uploadFiles(of, from, to)
Executes the upload procedure
Parameters:
{Array} | of | files |
{int} | from | |
{to} | to |
processFileChunkFrom(file, index, cb)
Processes a chunk from a file
this method is recalled everytime a chunk is completed.
it stops when all chunks are completed
Parameters:
{Object} | file | |
{int} | index | part of the file chunk |
{function} | cb | called after each upload chunk completion |