# Upload images in batch/bulk

**URL:** <https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097>\
**Category:** Rails\
**Created:** [August 15, 2007, 11:45am UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097 "2007-08-15T11:45:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![raj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@raj](https://www.ruby-forum.com/u/raj)\
**Post date:** [August 15, 2007, 11:45am UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097/1 "2007-08-15T11:45:05Z")

</div>

Hi,

I’m new to ruby and rails and have implemented a multiple image upload  
using the attachment\_fu plugin with great struggle 🙂 I need a  
feature that enables me to upload images in bulk/batch e.g. hundreds  
of images. I have had not much luck on finding any sources on this.  
Ideally I would like to upload images by just simply using ctr-shift  
to select all the images in a particular folder and upload them. Any  
suggestions on this or other possible methods on doing this?

Thanks

---

<div class="post-metadata">

**Author:** ![raj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@raj](https://www.ruby-forum.com/u/raj)\
**Post date:** [August 15, 2007, 11:54am UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097/2 "2007-08-15T11:54:06Z")

</div>

On 15 Aug 2007, at 11:43, raj wrote:

> I’m new to ruby and rails and have implemented a multiple image upload  
> using the attachment\_fu plugin with great struggle 🙂 I need a  
> feature that enables me to upload images in bulk/batch e.g. hundreds  
> of images. I have had not much luck on finding any sources on this.  
> Ideally I would like to upload images by just simply using ctr-shift  
> to select all the images in a particular folder and upload them. Any  
> suggestions on this or other possible methods on doing this?

Use SWFUpload ([http://swfupload.mammon.se/](http://swfupload.mammon.se/)). Because it uses Flash,  
the file selection dialog allows multiple selection, as well as  
filetype and filesize filtering. Be sure to search the archives for  
more info on implementing it, because there are a few catches (but  
once it’s up and running, it’s just fantastic).

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![raj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@raj](https://www.ruby-forum.com/u/raj)\
**Post date:** [August 15, 2007, 1:18pm UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097/3 "2007-08-15T13:18:16Z")

</div>

> Use SWFUpload ([http://swfupload.mammon.se/](http://swfupload.mammon.se/)). Because it uses Flash,  
> the file selection dialog allows multiple selection, as well as  
> filetype and filesize filtering. Be sure to search the archives for  
> more info on implementing it, because there are a few catches (but  
> once it’s up and running, it’s just fantastic).
> 
> Best regards
> 
> Peter De Berdt

Thanks Peter

Looks like a great application just need to figure out how to  
integrate it with ruby on rails. I’ll look into this.

Thanks again

Raj

---

<div class="post-metadata">

**Author:** ![raj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@raj](https://www.ruby-forum.com/u/raj)\
**Post date:** [August 15, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097/4 "2007-08-15T14:42:27Z")

</div>

On 15 Aug 2007, at 13:17, raj wrote:

> Looks like a great application just need to figure out how to  
> integrate it with ruby on rails. I’ll look into this.

You can just copy most of the example code. You can rewrite the  
callbacks to use prototype/scriptaculous (you’ll need to use some  
basic javascript for this).

A few pointers that may help you down the road:

- If the upload script is in an “authenticated” section of your  
application (i.e. dependent on the session): http://  
[blog.inquirylabs.com/2006/12/09/getting-the-\_session\_id-from-](http://blog.inquirylabs.com/2006/12/09/getting-the-_session_id-from-)  
swfupload/ You’ll need to pass the session id in the url
- In your method/action that handles the upload, don’t render a  
result page or redirect at the end of the method, just return a  
status code or render :nothing =\> true. You have to use the  
upload\_queue\_completed callback to render the result (i.e. show the  
new images, …)

If you search the archives, you’ll find some code snippets I already  
posted, this should also provide you with some tips.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![raj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@raj](https://www.ruby-forum.com/u/raj)\
**Post date:** [August 16, 2007, 2:10pm UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097/5 "2007-08-16T14:10:56Z")

</div>

On 15 Aug 2007, at 13:39, Peter De Berdt wrote:

> On 15 Aug 2007, at 13:17, raj wrote:
> 
> > Looks like a great application just need to figure out how to  
> > integrate it with ruby on rails. I’ll look into this.
> 
> If you search the archives, you’ll find some code snippets I  
> already posted, this should also provide you with some tips.

You may find some additional useful tips here:

[http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload](http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload)

Regards,  
Andy S.

---

<div class="post-metadata">

**Author:** ![raj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@raj](https://www.ruby-forum.com/u/raj)\
**Post date:** [September 12, 2007, 11:06am UTC](https://www.ruby-forum.com/t/upload-images-in-batch-bulk/112097/6 "2007-09-12T11:06:37Z")

</div>

Andrew S. wrote:

> On 15 Aug 2007, at 13:39, Peter De Berdt wrote:
> 
> > On 15 Aug 2007, at 13:17, raj wrote:
> > 
> > > Looks like a great application just need to figure out how to  
> > > integrate it with ruby on rails. I’ll look into this.
> > 
> > If you search the archives, you’ll find some code snippets I  
> > already posted, this should also provide you with some tips.
> 
> You may find some additional useful tips here:
> 
> [http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload](http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload)
> 
> Regards,  
> Andy S.

I have a problem that I’m working in Linux, hence flash is definite no.  
Any other suggestions? I have got an upload working see my other post  
[Multiple upload using attachement fu - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/124421#new), but am looking to enhance  
it.

Regards

Rajeev A.
