Namespace: ITHit.WebDAV.Server.ResumableUpload
The IUploadProgress type exposes the following members.
Name | Description | |
---|---|---|
GetUploadProgressAsync | Gets IEnumerable with items that are being uploaded to this item subtree. |
This interface should be implemented on files that can provide upload progress information to client application. Optionally it can be implemented on folder items.
When implementing this interface you may need to configure PutUploadProgressAndResumeModule and PostUploadProgressModule module in your web.config file if your WebDAV server is hosted in IIS/ASP.NET.
Usually client application requests upload progress in following cases:
To check if folder or file supports upload-progress report and resumable upload feature the client application will submit OPTIONS request to that item. If the item implements IUploadProgress interface Engine will add 'resumable-upload' token to DAV response header. See example below.
To get information about file upload progress client will submit REPORT request to that file with upload progress type. The Engine will call GetUploadProgressAsync method in this case. You will return an IEnumerableT that contains single item (this file implementing IResumableUpload) from GetUploadProgressAsync method implementation. The engine will extract necessary info from the returned IResumableUpload interface and return it to client. The response will contain XML with information about upload progress for the requested file: url of the file, number or bytes uploaded, total size of the file and time when last save operation occurred.
The response returned by server Engine to client is a REPORT multistatus response that contains three properties for each file:
See example of upload progress report below.
The client application can also submit upload-progress REPORT request to a folder. In this case from your GetUploadProgressAsync property implementation you will return IEnumerable containing files that are being uploaded that reside in the folder's subtree. The response XML will contain info about each file from the IEnumerableT in a separate response tag. See example below.
If item does not support upload-progress report and server is based on IT Hit WebDAV Server Engine the server will respond with '403 Forbidden' to REPORT request. The body will contain <A:supported-report xmlns="DAV:"/> element. If server does not support REPORT verb you will get 405 Method Not Allowed response.
OPTIONS request is used to determine if folder or file supports resumable upload.
Request:
OPTIONS /Folder/ HTTP/1.1 Host: davserver Content-Length: 0
HTTP/1.1 200 OK Content-Length: 0 Accept-Ranges: none DAV: 1, 2, resumable-upload Public: OPTIONS, PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK Allow: OPTIONS, PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK
Upload progress report submitted over file contains info about single item.
Request:
REPORT /LargeFile.doc HTTP/1.1 Host: http://davserver/ Content-Type: application/xml; charset=\"utf-8\" Content-length: 32 <upload-progress xmlns='ithit'/>
HTTP/1.1 207 Multi-Status Content-Length: 2452 Content-Type: application/xml;charset=UTF-8 <?xml version="1.0" encoding="utf-8" ?> <D:multistatus xmlns:D="DAV:"> <D:response> <D:href>http://server:8580/LargeFile.doc</D:href> <D:propstat> <D:prop> <ithit:bytes-uploaded>20</ithit:bytes-uploaded> <ithit:last-chunk-saved>Wed, 23 May 2007 13:29:43 GMT</ithit:last-chunk-saved> <ithit:total-content-length>150742</ithit:total-content-length> </D:prop> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> </D:multistatus>
Upload progress report submitted over folder contains info about all files being uploaded to subtree.
Request:
REPORT /folder HTTP/1.1 Host: http://server:8580/ Content-Type: application/xml; charset=\"utf-8\" Content-length: 32 <upload-progress xmlns='ithit'/>
HTTP/1.1 207 Multi-Status Content-Length: 2452 Content-Type: application/xml;charset=UTF-8 <?xml version="1.0" encoding="utf-8" ?> <D:multistatus xmlns:D="DAV:" xmlns:ithit="ithit"> <D:response> <D:href>http://server:8580/folder/LargeFile.doc</D:href> <D:propstat> <D:prop> <ithit:bytes-uploaded>20</ithit:bytes-uploaded> <ithit:last-chunk-saved>Wed, 23 May 2007 13:29:43 GMT</ithit:last-chunk-saved> <ithit:total-content-length>150742</ithit:total-content-length> </D:prop> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> <D:response> <D:href>http://server:8580/folder/nestedfolder/AnotherLargeFile.doc</D:href> <D:propstat> <D:prop> <ithit:bytes-uploaded>47</ithit:bytes-uploaded> <ithit:last-chunk-saved>Wed, 23 May 2007 13:16:12 GMT</ithit:last-chunk-saved> <ithit:total-content-length>6398</ithit:total-content-length> </D:prop> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> </D:multistatus>
If item on server based on IT Hit WebDAV Server Engine does not support upload-progress the server will respond with 403 Forbidden response.
Request:
REPORT /LargeFile.doc HTTP/1.1 Host: http://davserver/ Content-Type: application/xml; charset=\"utf-8\" Content-length: 32 <upload-progress xmlns='ithit'/>
HTTP/1.1 403 Forbidden Content-Length: 31 Content-Type: application/xml;charset=UTF-8 <supported-report xmlns="DAV"/>
If server does not support REPORT verb (often non-IT Hit Engine) you will get 405 Method Not Allowed response.
Request:
REPORT /LargeFile.doc HTTP/1.1 Host: http://davserver/ Content-Type: application/xml; charset=\"utf-8\" Content-length: 32 <upload-progress xmlns='ithit'/>
HTTP/1.1 405 Method Not Allowed Content-Length: 0 Content-Type: application/xml;charset=UTF-8