Uploading Files to WebDAV Server in Internet Explorer 9 and Earlier Versions

Important! This article is about upload in IE 9 and earlier versions. If you are using IE 10+, Chrome 4+, Firefox 7+, or Safari 4+ you do not need to read this article.

While WebDAV standard requires files to be uploaded via PUT verb, Internet Explorer 9 and earlier versions support only upload via POST. In addition Firefox v3.5 - v6 can upload files of only up to 100Mb in size via PUT verb. This article describes how upload is done when AJAX File Browser runs in one of these legacy browsers. All newer browsers, including IE 10 and later, support standards-compliant PUT upload.

Multipart Form POST-upload

To overcome the above limitations the IT Hit AJAX File browser is using a multipart form POST-upload when run in one of the above-mentioned browsers. While IT Hit WebDAV Server Engine supports both PUT and POST, if you are using a third-party WebDAV server, you may need to update your server code to accept files submitted via multipart form POST-upload.

To create and save Microsoft Office documents in IE 9 and earlier, there is no need in POST support on the server. The 'New Document' menu in AJAX File Browser works with any WebDAV-compliant server.

If the upload finished successfully, in response to a POST request your server must return multistatus XML with a single response node that has 200 OK status:

<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:">
  <d:status>HTTP/1.1 200 OK</d:status>

There is no way to analyze POST-upload response code in modern browsers, so AJAX File Browser relies on the status code in multistatus XML. If the status is 200 OK - upload was successful, otherwise upload failed and you will see the View Error menu in the context menu in the upload area.

Upload Progress Refresh Time

To refresh the upload progress, the IT Hit WebDAV Server Engine periodically submits the upload progress REPORT request to server. By default, this request is submitted every 5 seconds for every file that is being uploaded. To get and set the progress refresh time use GetProgressRefreshTime and SetProgressRefreshTime methods:

var ajaxFileBrowser = new ITHit.WebDAV.Client.AjaxFileBrowser.Controller('AjaxFileBrowserContainer','http://webdavserver.com/', 'height: 500px; width: 500px');
ajaxFileBrowser.SetProgressRefreshTime(10);  // set refresh time in seconds

To disable upload progress refresh set refresh time to 0;

Creating Custom Upload Progress Request Mechanism

While IT Hit WebDAV Server Engine provides interfaces for reporting upload progress, if you run any third-party WebDAV server you may want to create your own upload progress reporting mechanism. The IT Hit AJAX File Browser provides OnGetProgress event that is called for every file when progress data is required. In this event handler, you can request upload progress info from server using XmlHttpRequest, Flash, Silverlight, Java or any other technology. The AJAX File Browser passes URL of the item that is being uploaded to your event handler and requires you to create an instance of UploadProgressInfo and return it back to AJAX File Browser:

function onGetProgress(itemUrl) {
    var fileProgress = new MyObjectForRequestingProgress(itemUrl);
    return new ITHit.WebDAV.Client.AjaxFileBrowser.UploadProgressInfo(fileProgress.BytesUploaded, fileProgress.TotalContentLength);
var ajaxFileBrowser = new  ITHit.WebDAV.Client.AjaxFileBrowser.Controller('AjaxFileBrowserContainer', 'http://webdavserver.com/', 'height: 500px; width: 500px');
ITHit.Events.AddListener(ajaxFileBrowser.GetProgressManager(), 'OnGetProgress', onGetProgress);

UploadProgressInfo class requires amount of bytes uploaded and total file size to be passed to its constructor.