HTTP PUT for file uploads

Mike Mike lists at ruby-forum.com
Sat Aug 2 15:15:27 MSD 2008


FYI: this thread did not seem to get sent to the nginx mailing list for 
some reason, oddly enough.




Michael wrote:
> On Fri, Aug 01, 2008 at 13:10:46, Phillip B Oldham said...
> 
>> Don't want to sound off, but isn't that what FTP was designed for?

I always tell people - FTP was designed for this. But this is a) not a 
solution for our stakeholders and end-users and b) a common thing coming 
up nowadays on many sites. you can't just give out FTP accounts and hope 
to have some smart system that understands when files are done, how to 
integrate them into the system, etc.

> FTP is such an awful protocol to deal with regarding firewalls, I'd much 
> rather
> go the way the original poster is and use HTTP PUT for insecure stuff, 
> and SFTP
> for secure stuff.

Exactly. and I believe since PUT uses HTTP, it can be sent over a secure 
channel as well just the same.

> But 2GB?  That's huge... a lot for an end-user to just sit and watch 
> without
> clicking reload or something.

That's why an intelligent uploader would handle the re-trying/etc. until 
it was complete. Machines don't get bored :)

> 
>> You may have to test this, but I'd assume the maint-stream browsers support 
>> PUT via the XMLHTTPRequest javascript object.
> 
> I was just doing some of this myself yesterday - doesn't seem like 
> there's a
> way to do file uploads with AJAX, but you can easily make a form with a 
> target
> iframe... but this is really offtopic for the nginx list.

I don't believe it can either. I am fine with it not supporting that as 
well.

Also if anyone has any pointers on how to get nginx to accept PUTs.. I 
was trying to proof of concept this quick with an HTML form + simple PHP 
script:

<form method="put" action="work.php">
 File: <input type="file" />
 <input type="submit" value="Submit" />
</form>

Shouldn't that work? It keeps issuing a GET:

192.168.1.2 - - [02/Aug/2008:04:08:07 -0700] GET /put/work.php? HTTP/1.1 
"200" 23 "http://192.168.1.3/put/" "Mozilla/4.0 (compatible; MSIE 6.0; 
Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 
3.0.04506.30; .NET CLR 3.0.04506.648)" "-"

Seems a bit odd. I've done this in nginx config too:

dav_methods  PUT;
create_full_put_path on;
dav_access all:r;

(nginx is compiled with the dav module)

(I figured I'd at least see a PUT request with a failure)
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list