Home
english
Home
.NET Server
Java Server
.NET Client
AJAX Client
AJAX Browser
Map Drive
Pricing
Contacts
info@ithit.com



Uploading Files to WebDAV Server in Internet Explorer and Legacy Browsers

While WebDAV standard requires files to be uploaded via PUT verb, Internet Explorer and legacy browsers 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 browsers. For the up to date list of browsers that support standards-compliant PUT-upload and supported maximum file size please refer to the Requirements page.

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 there is no need in POST support on 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:response>
  <d:href>http://webdavserver.com/serv/Report.xlsx</d:href>
  <d:status>HTTP/1.1 200 OK</d:status>
 </d:response>
</d:multistatus>

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 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 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.


Selected Customers:
Country: Norway
DnB NOR Group
Country: Finland
Bank of Finland
USA
Symantec
Country: Sweden
Toyota
Country: Denmark
Danfoss Group
Country: USA
Microsoft
Country: Ukraine
Raiffeisen Bank
Country: USA
Siemens
Country: Ukraine
OTP Bank
Country: USA
Intel Corporation
Country: Austria
Austrian Federal Railways
Country: Israel
Autodesk, Inc.
Country: USA
U.S. Customs and Border Protection Agency
Home .NET Server Java Server .NET Client AJAX Client AJAX Browser Map Drive Pricing Contacts

Updated: Wednesday, October 05, 2011