Question: Single uploads? #44

iashraf opened this Issue Jan 20, 2013 · 7 comments

6 participants


Hi all, sorry for asking a question in the issues section. Is there any way to use this gem for single uploads only?

I have this gem working great with multiple uploads, but on some pages I want to limit it to single uploads if possible (for example, uploading user avatars)

Many thanks!


Just set the multiple parameter to false instead of true !

<%= file_field_tag :file, multiple: false %>


Hi there, thanks for your answer.

That works if you use the "browse" form button to upload images, but you can also drag-n-drop multiple files onto the window and it will treat it as multiple file upload.



Hi all,

One way I've found to get around this is to add my own and in it setting a "dropzone" (a feature of jquery file uploader)



setUploadForm = ->

After add:

        dropZone: $('#dropzone')

Then something like this in the views where I want multi-file uploads:

<div id="dropzone" style="background: #ccc; height: 100px;">drop files here</div>

This stops the whole window being a drop target, so we can control which pages (that have uploaders) have drag and drop targets. I will only include a "dropzone" on pages I want multi-file uploads.

Is there already a setting in this gem that I'm missing? Am I taking the long way around?


No, there isn't a setting for the dropZone yet, there should be. :)


I was just about to post a question around editing (re-uploading) files. I have it sorted on the controller end, but was wondering how you guys are changing the uploader to allow single files only. Also having the callback hit an update route with put instead of a create route with post.


Related to this,
1. Upload a single file using the "click_submit_target" option
2. Choose another file before hitting submit
3. Both files get sent to the server


@iashraf's does the job, it would be great to integrate that into the gem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment