English 中文(简体)
我在上载后如何用高超重载重回LURL的形象?
原标题:How do I get swfupload to return image URL after upload?

我正面临一个真正的棘手问题。 我正在使用超负荷向图像Shack服务器上载多个图像。 我还正在将已归还的URLs储存在数据库中。 我在我收到后,如何向用户展示从图像Shack返回的URL? 卸载后再卸载后是否会有任何办法? 这里是我用来上载图像的代码:

$( #swfupload-control ).swfupload({  
    upload_url: "<%= upload_url-%>",  
    file_post_name:  photo ,  
    post_params: {"authenticity_token" : "<%= form_authenticity_token %>"},
    file_size_limit : "100024",  
    file_types : "*.jpg;*.png;*.gif",  
    file_types_description : "Image files",  
    file_upload_limit : 5,  
    flash_url : "/flash/swfupload.swf",  
    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= <li id=" +file.id+ " > +  
         File: <em> +file.name+ </em> ( +Math.round(file.size/1024)+  KB) <span class="progressvalue" ></span> +  
         <div class="progressbar" ><div class="progress" ></div></div> +  
         <p class="status" >Pending</p> +  
         <span class="cancel" >&nbsp;</span> +  
         </li> ;  
    $( #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= <a href=" +fetchedfile+ " target="_blank" >view &raquo;</a> ; 
    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 );  
});

在轮载文件上载图像文档中,没有专用的电击功能。

最佳回答

奥赫里语很简单。

.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% ); 
    fetchedfile = serverData;
    var pathtofile= <a href=" +fetchedfile+ " target="_blank" >view &raquo;</a> ; 
    item.addClass( success ).find( p.status ).html( Done!!! |  +pathtofile); 
}) 
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签