# Prototype Ajax + File Uploading-- How?

**URL:** <https://www.ruby-forum.com/t/prototype-ajax-file-uploading-how/53984>\
**Category:** Rails\
**Created:** [February 19, 2006, 8:01am UTC](https://www.ruby-forum.com/t/prototype-ajax-file-uploading-how/53984 "2006-02-19T08:01:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfeadler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f6c823/32.png) [@mfeadler](https://www.ruby-forum.com/u/mfeadler)\
**Post date:** [February 19, 2006, 8:01am UTC](https://www.ruby-forum.com/t/prototype-ajax-file-uploading-how/53984/1 "2006-02-19T08:01:07Z")

</div>

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:

.....

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

---

<div class="post-metadata">

**Author:** ![mfeadler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f6c823/32.png) [@mfeadler](https://www.ruby-forum.com/u/mfeadler)\
**Post date:** [February 19, 2006, 8:07am UTC](https://www.ruby-forum.com/t/prototype-ajax-file-uploading-how/53984/2 "2006-02-19T08:07:09Z")

</div>

take a look here:

[http://www.kylemaxwell.com/](http://www.kylemaxwell.com/)

---

<div class="post-metadata">

**Author:** ![mfeadler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f6c823/32.png) [@mfeadler](https://www.ruby-forum.com/u/mfeadler)\
**Post date:** [February 19, 2006, 8:19am UTC](https://www.ruby-forum.com/t/prototype-ajax-file-uploading-how/53984/3 "2006-02-19T08:19:11Z")

</div>

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
