views:

32

answers:

1

Does anyone have code of a simple web browser file/script (HTML/javascript/whatever) that can upload a user selected file to a server using HTTP PUT?

Everything I keep reading says that browsers do support HTTP put, but just not through any scripting?!

What is the most common way to upload a file then? Using post??

+3  A: 

It's normally a POST, using a form with a special attribute: enctype="multipart/form-data"

You'll need a server-side technology to accept the file and then do something with it.

I guess plain old PHP is a cheap and easy way to achieve this, but I guess you probably have an existing website or something which you're trying to work with, right?

Here's a php tutorial, (there's millions out there): http://www.tizag.com/phpT/fileupload.php

amir75
Something to add: most browsers don't even understand PUT.
Time Machine
I am working on am embedded server that generates pages, and I am trying to work out the best way to upload files to it that is compatible with most browsers. I can make the server handle anything with any attributes for GET or POST, so I just need a way to serve a small script/html file for a browser to bring up a file select dialog and send the file.
myforwik