title: How do I get swfupload to return image URL after upload?
body: <p>I am facing a really weird problem. I am using swfupload to upload multiple images to the ImageShack server. I am also storing the returned URLs in the database. How do I show the URL returned from ImageShack to the user as soon as I receive it? Is there any way to make swfupload return the URL once upload finishes? Here is the code that I use for uploading images:</p>
  <pre><code>$('#swfupload-control').swfupload({  
      upload_url: &quot;&lt;%= upload_url-%&gt;&quot;,  
      file_post_name: 'photo',  
      post_params: {&quot;authenticity_token&quot; : &quot;&lt;%= form_authenticity_token %&gt;&quot;},
      file_size_limit : &quot;100024&quot;,  
      file_types : &quot;*.jpg;*.png;*.gif&quot;,  
      file_types_description : &quot;Image files&quot;,  
      file_upload_limit : 5,  
      flash_url : &quot;/flash/swfupload.swf&quot;,  
      button_image_url : '/javascripts/swfupload/XPButtonUploadText_61x22.png',  
      button_width : 62,  
      button_height : 22,  
      button_placeholder : $('#button')[0],  
      debug: false  
  })  
  .bind('fileQueued', function(event, file){  
      var listitem='&lt;li id=&quot;'+file.id+'&quot; &gt;'+  
          'File: &lt;em&gt;'+file.name+'&lt;/em&gt; ('+Math.round(file.size/1024)+' KB) &lt;span class=&quot;progressvalue&quot; &gt;&lt;/span&gt;'+  
          '&lt;div class=&quot;progressbar&quot; &gt;&lt;div class=&quot;progress&quot; &gt;&lt;/div&gt;&lt;/div&gt;'+  
          '&lt;p class=&quot;status&quot; &gt;Pending&lt;/p&gt;'+  
          '&lt;span class=&quot;cancel&quot; &gt;&amp;nbsp;&lt;/span&gt;'+  
          '&lt;/li&gt;';  
      $('#log').append(listitem);  
      $('li#'+file.id+' .cancel').bind('click', function(){
          //Remove from queue on cancel click  
          var swfu = $.swfupload.getInstance('#swfupload-control');  
          swfu.cancelUpload(file.id);  
          $('li#'+file.id).slideUp('fast');  
      });  
      // start the upload since it's queued  
      $(this).swfupload('startUpload'); 
  }) 
  .bind('fileQueueError', function(event, file, errorCode, message){ 
      alert('Size of the file '+file.name+' is greater than limit'); 
  }) 
  .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){ 
      $('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued); 
  }) 
  .bind('uploadStart', function(event, file){ 
      $('#log li#'+file.id).find('p.status').text('Uploading...'); 
      $('#log li#'+file.id).find('span.progressvalue').text('0%'); 
      $('#log li#'+file.id).find('span.cancel').hide(); 
  }) 
  .bind('uploadProgress', function(event, file, bytesLoaded){ 
      //Show Progress 
      var percentage=Math.round((bytesLoaded/file.size)*100); 
      $('#log li#'+file.id).find('div.progress').css('width', percentage+'%'); 
      $('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
  }) 
  .bind('uploadSuccess', function(event, file, serverData){ 
      var item=$('#log li#'+file.id), fetchedfile;  
      item.find('div.progress').css('width', '100%'); 
      item.find('span.progressvalue').text('100%'); 
  
      var pathtofile='&lt;a href=&quot;'+fetchedfile+'&quot; target=&quot;_blank&quot; &gt;view &amp;raquo;&lt;/a&gt;'; 
      item.addClass('success').find('p.status').html('Done!!! | '+pathtofile); 
  }) 
  .bind('uploadComplete', function(event, file){ 
      // upload has completed, try the next one in the queue 
        
      $(this).swfupload('startUpload');  
  });
  </code></pre>
  <p>There is no inbuilt callback function for fetching the URL of the uploaded image file in the swfupload documentation.</p>