Over the past decade and a half, I’ve known that WebDAV exists (and been grateful for that fact), but I have mostly ignored it. Today, as an experiment, I set up an Apache WebDAV server on my laptop. It’s great, except that it’s missing one thing I’d always assumed it would have: the ability to upload a file and let the server decide the URL.
This is an important feature for any web repository that’s shared among multiple users or client systems. For example, let’s say that User A wants to upload a file named
funny-cat-pic.jpg and User B also wants to upload a file named
Using HTTP PUT, they can both specify that it belongs in
/pix/funny-cat-pic.jpg, but then the second one will simply overwrite the first one.
Using HTTP POST, on the other hand, they could each upload their files, and then receive HTTP
303 (See Other) responses providing the URLs that the WebDAV server chose, e.g.
/pix/funny-cat-pic-002.jpg. The server could guarantee that a POSTed file never overwrote an existing one.
I know I can just write a short Python or PHP script to do the posting, but before I do that, am I missing anything? Supporting POST seems like it should have been an obvious choice from the start.