Uploading Files to WebDAV Server in AJAX Application in IE and Legacy Browsers
This article applies to Internet Explorer as well as to Safari 3, Firefox 3.4, Chrome 3 and earlier versions.
While WebDAV standard requires files to be uploaded via PUT verb, Internet Explorer and legacy browsers listed above support only upload via POST. In addition Firefox 3.5 and later can upload files of only up to 100Mb in size via PUT verb. This article describes how to upload a file to IT Hit WebDAV Server Engine using POST request in the above listed browsers.
Uploading using POST Multipart Request
The IT Hit WebDAV Server Engine for .Net and for Java can process files submitted with POST multipart request. The following example uploads a file to /mydocs folder:
<html>
<head><title>POST Upload to WebDAV Server</title></head>
<body>
<form action="/mydocs/" method="post" enctype="multipart/form-data">
<input type="file" name="dummyname" /><br />
<input type="submit" />
</form>
</body>
</html>
When creating a multipart POST form make sure you follow this rules:
- Specify enctype="multipart/form-data" attribute on a form tag.
- Add name attribute to a single input type=file tag.
- DO NOT add name attribute to any other input, select, textarea tags.
Always submit only one file per form. The server will be unable to calculate file size correctly if any extra input/select/textarea values submitted due to POST request standard limitations.
Action attribute can specify a folder or a file url. If the file with such name does not exist it will be created. If the file already exists it will be overwritten.
Note that maximum file upload size in most browsers is 2Gb.
|