List of items being uploaded. Each item in the list describes the file
or folder upload state and provides methods for managing upload.
Fires:
Members
-
Uploader :ITHit.WebDAV.Client.Upload.Uploader
Uploader -
Associated uploader.
Methods
-
AddListener(sEventName, fCallback, oContext)
AddListener -
Add event handlers.
Name Type Description sEventName
string The event name to handle. fCallback
function The callback to call. oContext
Object optional The context to callback is called with. -
RemoveByUrl(sUrl)
RemoveByUrl -
Removes upload file from queue.
Name Type Description sUrl
string The url of UploadItem to remove. -
RemoveListener(sEventName, fCallback, oContext)
RemoveListener -
Removes event listener.
Name Type Description sEventName
string The event name to remove. fCallback
function The callback to remove. oContext
Object optional The context to callback is called with. -
Restart(aUploadItems)
Restart -
Name Type Description aUploadItems
Array.<ITHit.WebDAV.Client.Upload.UploadItem> Collection restart.
Events
-
OnQueueChanged
OnQueueChanged -
Event reporting that queue changed. Fired when item is added or deleted from queue.
Properties:
Name Type Description Sender
ITHit.WebDAV.Client.Upload.Queue The queue instance. Name
string Event name. AddedItems
Array.<ITHit.WebDAV.Client.Upload.UploadItem> Added items. RemovedItems
Array.<ITHit.WebDAV.Client.Upload.UploadItem> Removed items. Example
var oUploader = new ITHit.WebDAV.Client.Upload.Uploader(); oUploader.Queue.AddListener('OnQueueChanged', function (oQueueChanged) { oQueueChanged.AddedItems.forEach(function(element) { console.log('Upload added:' + element.GetName()); }); };
-
OnUploadItemsCreated
OnUploadItemsCreated -
Event fired ITHit.WebDAV.Client.Upload.UploadItems are created. You will validate files selected for upload in this event and present user interface if user interaction is necessary. In this event you can check if each item exists on the server and specify if item should be overwritten or skipped. You can also validate file size, file extension, file upload path and file name. To continue upload the ITHit.WebDAV.Client.Upload.Events.UploadItemsCreated#Upload function with the list of items to be uploaded should be called.
Type:
Example
var oUploader = new ITHit.WebDAV.Client.Upload.Uploader(); oUploader.Queue.AddListener('OnUploadItemsCreated', function(oUploadItemsCreated) { var aIgnoredNames = ['file1.txt', 'file2.txt']; /** @typedef {ITHit.WebDAV.Client.Upload.UploadItem[]} aItems */ var aItems = oUploadItemsCreated.Items; /** @typedef {ITHit.WebDAV.Client.Upload.UploadItem[]} aItemsToUpload */ var aItemsToUpload = aItems.filter(function(oItem) { aIgnoredNames.indexOf(oItem.GetName()) < 0 } oUploadItemsCreated.Upload(aItemsToUpload); });