views:

553

answers:

6

I tried following the example at: http://www.plupload.com/example_custom.php

But in the request, file is not sent to the method of the controller, only the name.

Maybe I need to set in the configuration of Plupload, something like 'multipart = true'

Any idea?

+1  A: 

I have no experience with Plupload I don't think you should have to explicitly deal with multipart uploads in the plugin configuration. (That is a file uploader library after all.) Don't get me wrong but do you have the multipart attribute set to true in the html markup?

Attila Györffy
Normally in the normal upload form, I write ':html=>(:multipart => true)'.For example, for SWFUpload (http://swfupload.org/) I have to specify in its configuration 'post_params:("authenticity_token":"<% = form_authenticity_token %>"}', otherwise I get an error. But with Plupload in the rails logs I have no error, with Firebug I see that the file is sent to the controller, but when I call 'logger.debug params.inspect' I only have the name of the file.
Sebtm
A: 

W3C states this for file upload...

 <FORM action="http://server.com/cgi/handle"
       enctype="multipart/form-data"
       method="post">
   <P>
   What is your name? <INPUT type="text" name="submit-name"><BR>
   What files are you sending? <INPUT type="file" name="files"><BR>
   <INPUT type="submit" value="Send"> <INPUT type="reset">
 </FORM>
ramonrails
A: 

Can we see some more code. There's a lot that could be going wrong.

Also, can you use debugger after the form submission and post a params output here?

J

P.s. By the way, tried to make this a comment but no go...

Josh Pinter
You must have reputation above 50 to leave comments.
Evgeny Shadchnev
Gotcha, at a reputation of 47 I cannot be trusted :)
Josh Pinter
A: 

Try swfupload. Google it.

User
1. unhelpful2. read whole thread before answering -- swfupload was already mentioned by OP (original poster) Sebtm Feb 15 at 7:46. Also, swfupload is already used in the plupload-package, so:3. read the question including links before answering4. good luck! :-)
Simon B.
A: 

A few "any" ideas... :-p

  1. Is there any chance the file you try to upload gets filtered by some security feature in Rails, the rails-proxying server (apache?), or even some software on clientside?

  2. Did you try different browsers, to verify it's not a clientside problem? (sniffing your network connection could be another way to verify that the file actually gets sent to the server)

  3. If you happen to be using rack, then there is some middleware that can take care of file uploads for you. Not what you wanted, but perhaps useful as a temporary workaround while waiting in case you'd discover you have to wait for some bugfixing in rails or plupload.

  4. Permissions on the folder where uploaded files are supposed to go? Or do they go in memory first, and write to disk later? Maybe the plupload library uses temporary files somewhere and the permissions aren't working out there.

Simon B.
Simon B.
A: 

The question was ages ago. But will answer for other people looking for a solution.

The solution for this is adding "multipart : true" on your pluploadQueue({}) function. That would send the file as multipart. For multiple files, it will send/POST the request multiple times. Then you can handle that on your controller.

Hope this helps.

Jas

Jason Torres
How do you change the file post name param? It defaults to "file". Can that be changed to some custom param? Any config option available for doing that?
Shripad K