Good evening! I''m currently trying to submit some data and a file upload through Ajax. I''m using rails & prototype, and somewhere there''s a disconnect. I''m reasonably convinced the file upload isnt being sent at all, or if it is, Rails has absolutely no idea. The form itself heads with: <form onsubmit="new Ajax.Request(''create'', {onSuccess: postNew, parameters: Form.serialize(this)} ); return false;"> <input type="file" name="if" id="image_file"> ..... </form> The logs show everything else getting submitted normally, but I''m not seeing params[:if] or params[:image_file] (not sure which I should expect, but neither are there), nor am I seeing anything in the logs from the running fastcgi install; Processing AdminInterfaceController#create (for W.X.Y.Z at 2006-02-19 01:31:25) [POST] Parameters: {"dp"=>{"picture_file"=>"", "city"=>"PORTSMOUTH", "latitude"=>"43.078843", "title"=>"Market JUNK", "geo_source"=>"Yahoo", "zipcode"=>"03801-3730", "description"=>"", "street"=>"128 MARKET ST", "longitude"=>"-70.758461", "user_location"=>"128 market st", "state"=>"NH"}, "commit"=>"Capture", "action"=>"create", "controller"=>"admin_interface"} Pardon the verbosity; again, nothing from the file input form object. Even if I give the file input a id="dp_picture_file" name="dp[picture_file]", dp[:picture_file] is still "", still nothing. I''m pretty sure Prototype is just not serializing the file-input at all. How can I get the file to upload and, if necessary, serialize, and how can I make this cleanly integrate with rails? Many thanks! rektide -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060219/fec78ee4/attachment.html
take a look here: http://www.kylemaxwell.com/ On 2/19/06, Matthew Fowle <rektide@gmail.com> wrote:> > Good evening! > > I''m currently trying to submit some data and a file upload through Ajax. > I''m using rails & prototype, and somewhere there''s a disconnect. I''m > reasonably convinced the file upload isnt being sent at all, or if it is, > Rails has absolutely no idea. The form itself heads with: > > <form onsubmit="new Ajax.Request(''create'', {onSuccess: postNew, > parameters: Form.serialize(this)} ); return false;"> > <input type="file" name="if" id="image_file"> > ..... > </form> > > The logs show everything else getting submitted normally, but I''m not > seeing params[:if] or params[:image_file] (not sure which I should expect, > but neither are there), nor am I seeing anything in the logs from the > running fastcgi install; > > Processing AdminInterfaceController#create (for W.X.Y.Z at 2006-02-19 > 01:31:25) [POST] > Parameters: {"dp"=>{"picture_file"=>"", "city"=>"PORTSMOUTH", > "latitude"=>"43.078843", "title"=>"Market JUNK", "geo_source"=>"Yahoo", > "zipcode"=>"03801-3730", "description"=>"", "street"=>"128 MARKET ST", > "longitude"=>"-70.758461", "user_location"=>"128 market st", > "state"=>"NH"}, "commit"=>"Capture", "action"=>"create", > "controller"=>"admin_interface"} > > Pardon the verbosity; again, nothing from the file input form object. > > Even if I give the file input a id="dp_picture_file" > name="dp[picture_file]", dp[:picture_file] is still "", still nothing. > > I''m pretty sure Prototype is just not serializing the file-input at all. > How can I get the file to upload and, if necessary, serialize, and how can I > make this cleanly integrate with rails? > > Many thanks! > rektide > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060219/5111e461/attachment.html
Whoo, not pretty. Should work though, thanks! Thank heaven someone far smarter than I ran this problem down recently. With rails, Ajax &co is easy as pie, heaven forbid I have to actually, you know, start worrying about hidden iFrames & such. Thanks, Myren -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060219/8a7b9d2c/attachment-0001.html