Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Rails, using Andrew Valum's uploader
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bigos  
View profile  
 More options Feb 11, 8:15 am
Newsgroups: comp.lang.ruby
From: Bigos <ruby.obj...@some.server.con>
Date: Sat, 11 Feb 2012 13:15:40 +0000
Local: Sat, Feb 11 2012 8:15 am
Subject: Rails, using Andrew Valum's uploader
Hi,

I am trying to create multiple file upload using Andrew Valum's uploader
http://valums.com/ajax-upload/  .

When I try to upload example files I get following output:
background1.jpg 22.2kB Successfully Uploaded!
birdie.jpg 0.1MB       Failed
black.gif 1.5kB        Failed

Most of the time all files seem to be uploaded correctly despite  having
error messages.

I can't understand what I am doing wrong here.

Relevant code in application.html.erb

<script>
function createUploader(){
     var uploader = new qq.FileUploader({
         allowedExtensions: [],
         element: document.getElementById('file-uploader-demo1'),
         action: '/wedding_photos/multiupload',

         onComplete: function(id, fileName, responseJSON){
           if (responseJSON.success) {
             $$('.qq-upload-failed-text').first().update(' Successfully
Uploaded!');
           }
           else
           {
             $$('.qq-upload-failed-text').first().update(' Hmm .. upload
failed');
           }
         }
     });

}

// in your app create uploader as soon as the DOM is ready
// don't wait for the window to load
window.onload = createUploader;
    </script>

And this is method definition in the relevant controller
  def multiupload
     logger.info "\n\n\n I'm in multiupload\n\n\n"

     @filename = params['qqfile']

     newf = File.open('/tmp/nextAttempt_' + @filename, "wb")
     str =  request.body.read
      newf.write(str)
     newf.close

     render :text => '{success:true}'
   end

--------the end----------the end---------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »