Form File Uploads

2008-08-27 Thread Josh Schairbaum
Is there a good blog post, article tutorial, anything on doing a file  
upload in Camping?  I've been looking around, but I haven't found  
anything yet.


Regards,
Josh
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Form File Uploads

2008-08-27 Thread Bluebie, Jenna
If you're using Camping 2.0 stuff off github, file uploads work  
exactly as they do in regular rack, so search around for rack upload  
examples. :)


In camping 1.5, it works quite similarly, like this:

input.fieldname.tempfile.length #= how many bytes long it is
input.fieldname[:type] #= mimetype of upload
input.fieldname.tempfile.read #= gets you the files contents...  
tempfile will be some kind of an IO object.


I think you can do .filename also, but I don't use it in my projects.

Rack is similar, though at least in builds before Mash got in on the  
action, the syntax was a bit different.

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list