# Upload File Using form\_remote\_tag?

**URL:** <https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026>\
**Category:** Rails\
**Created:** [April 30, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026 "2007-04-30T23:26:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 30, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026/1 "2007-04-30T23:26:57Z")

</div>

Is it possible to create a multipart form that uploads the file using  
an AJAX remote call? I’m having a hard time figuring out the syntax  
if it is possible!

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 30, 2007, 11:57pm UTC](https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026/2 "2007-04-30T23:57:59Z")

</div>

Hi, I can tell you that is absolutely not possible to upload files  
with AJAX or Javascript of any kind. JS has always been prevented from  
accessing the client filesystem as a basic security feature. The only  
way is regular POST

hth

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 1, 2007, 4:26am UTC](https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026/3 "2007-05-01T04:26:39Z")

</div>

[http://blog.caboo.se/articles/2007/4/2/ajax-file-upload](http://blog.caboo.se/articles/2007/4/2/ajax-file-upload)

TomRossi7 wrote:

> Is it possible to create a multipart form that uploads the file using  
> an AJAX remote call? I’m having a hard time figuring out the syntax  
> if it is possible!
> 
> Thanks,  
> Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 1, 2007, 2:31pm UTC](https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026/4 "2007-05-01T14:31:56Z")

</div>

It isn’t possible. You can upload to a hidden div, though. Here’s a  
plugin that helps with that:

[http://agilewebdevelopment.com/plugins/responds\_to\_parent](http://agilewebdevelopment.com/plugins/responds_to_parent)

–  
Building an e-commerce site with Rails?  
[http://agilewebdevelopment.com/rails-ecommerce](http://agilewebdevelopment.com/rails-ecommerce)

Meet up at RailsConf:  
[http://railsconf2007.conferencemeetup.com/](http://railsconf2007.conferencemeetup.com/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 1, 2007, 10:57am UTC](https://www.ruby-forum.com/t/upload-file-using-form-remote-tag/103026/5 "2007-05-01T10:57:42Z")

</div>

Which is but one solution to the problem. I prefer SWFUpload (http://  
swfupload.mammon.se/), because it doesn’t involve polling the server  
for upload progress (the small flash movie monitors the upload  
stream) and it allows better file selection (filtering of files, max  
size, multiple selections in dialog, Â…). You can see an  
implementation at [http://demo.placid.be/albums/11;manage](http://demo.placid.be/albums/11;manage)

On 01 May 2007, at 04:26, mixplate wrote:

> [Parked at Loopia](http://blog.caboo.se/articles/2007/4/2/ajax-file-upload)
> 
> TomRossi7 wrote:
> 
> > Is it possible to create a multipart form that uploads the file using  
> > an AJAX remote call? I’m having a hard time figuring out the syntax  
> > if it is possible!

Best regards

Peter De Berdt
