i'm working on a piece that requires companies to be able to POST data to one another's web sites using just the URL without page name (i.e. http://doc_uploads.partnetsite.com). there's also no need for any kind of web interface at either end, so i can't expect to grab the data from a form field and save to disk. simply put, using an application like CURL, i should be able to execute a command that says "post myFile.txt to http://doc_uploads.partnersite.com".
i need to figure out how to configure doc_uploads.mysite.com to listen for POST commands and start up an application to capture the POST data and save to disk.
i've seen a few articles on how to use microsoft's posting acceptor to do file uploads, but this requires having the user fill in fields on a page which i can't ask the sender to do.
anybody have any idea how to pull this off? i thought i knew IIS pretty well, but this one has me totally stumped.
I can think of a few ways to do what you are asking on IIS, and each has its benefits and drawbacks. In no particular order:
- Use IIsWebFile to configure a specific URL's Default Document to be the POST acceptor.
- Use ISAPI Filter to rewrite specific incoming URL without page name to URL with the POST acceptor as the page name
- Enable and use WebDAV PUT
Whichever is "better" depends on which benefit(s)/drawback(s) you require. The benefits and drawbacks of each approach are as follows, in no particular order.
This solution is simply IIS configuration of the POST acceptor code. It requires IIS6 on Windows Server 2003, and the POST request URL must end with a backslash to invoke the Default Document without needing 302 courtesy redirection for POST support from the client (i.e. client sends POST to
The ISAPI Filter solution requires writing and maintaining C code for the ISAPI Filter, code for the POST acceptor, and IIS configuration for both the ISAPI Filter and POST acceptor code. It works on any IIS version and there are no requirements on the format of the POST request URL.
WebDAV is purely IIS configuration - no POST acceptor nor C code required. It works on all IIS versions that support WebDAV (pretty much all currently supported IIS versions except the latest IIS7 release, but that should be fixed soon), and the request must look like
PUT http://doc_uploads.partnetsite.com/myFile.txt and myFile.txt will be available for retrieval by anyone via
GET http://doc_uploads.partnetsite.com/myFile.txt UNLESS you control all applications on IIS from inadvertently serving that resource via some mechanism (NTFS ACLs, IIS Access Permissions, etc).
i.e. once you PUT a file to the web server, it can be retrieved via GET. This is different from a POST acceptor which can be configured to store files outside the URL namespace to avoid inadvertent web-based access of those uploaded resources.
I have only provided the categories of solutions possible - the specific solution for your situation requires more details about your requirements. You do not need to worry about user interactivity, FORM fields, grabbing data, Posting Acceptor, etc - all those tasks can be automated. There are many ways to "post myFile.txt to http://doc_uploads.partnersite.com", and you have only scratched the surface of your requirements...