Uploadify jQuery question3 new permission -
in jquery uploadify while upload file show progress bar show process.when come 100% or completed file remove 1 one queue.
i want know while file completed 100% should not remove un till cancel button not press file should remain there
means file attachment in uploadify.
that code of uploadify please give idea regarding this.
$('#uploadify').uploadify({ // var val = document.getelementbyid("giveresponse").value; 'uploader': 'swf/uploadify.swf', 'script': '<%= request.getcontextpath()%>/vendor.uploadticket.form?', 'folder': '/uploads', 'queueid' : 'filequeue', 'cancelimg': 'swf/cancel.png', 'filedataname': "filedata", 'fileext':<%=allowedfile%>, 'filedesc':<%=allowedfile%>, 'scriptdata' :{'ticketid': '<%= supportticket.getticketid()%>','action':'savegiveresponse','vendorid':'<%= vendor.getvendorid()%>'}, 'multi' : true, 'onuploadstart' : function() { alert($('#giveresponse').val()); $('#uploadify').uploadifysettings('scriptdata', {'giveresponse':$('#giveresponse').val(),'oldid':'<%= lastresponseid%>' }); }, 'onselectonce' : function() { $('#uploadify').uploadifysettings('scriptdata', {'giveresponse':$('#giveresponse').val(),'oldid':'<%= lastresponseid%>' }); }, 'onallcomplete' : function() { alert('files upload successfully');document.getelementbyid("giveresponse").value = ""; location.reload();} });
$('#uploadify').uploadify({ // var val = document.getelementbyid("giveresponse").value; 'uploader': 'swf/uploadify.swf', 'script': '<%= request.getcontextpath()%>/vendor.uploadticket.form?', 'folder': '/uploads', 'queueid' : 'filequeue', 'cancelimg': 'swf/cancel.png', 'filedataname': "filedata", 'fileext':<%=allowedfile%>, 'filedesc':<%=allowedfile%>, 'removecompleted' : false, 'scriptdata' :{'ticketid': '<%= supportticket.getticketid()%>','action':'savegiveresponse','vendorid':'<%= vendor.getvendorid()%>'}, 'multi' : true, 'onuploadstart' : function() { alert($('#giveresponse').val()); $('#uploadify').uploadifysettings('scriptdata', {'giveresponse':$('#giveresponse').val(),'oldid':'<%= lastresponseid%>' }); }, 'onselectonce' : function() { $('#uploadify').uploadifysettings('scriptdata', {'giveresponse':$('#giveresponse').val(),'oldid':'<%= lastresponseid%>' }); }, 'onallcomplete' : function() { alert('files upload successfully');document.getelementbyid("giveresponse").value = ""; location.reload();} });
set new option -> 'removecompleted' => false
also view comment , try best next time :)
edit:
so want able remove selected file queue of uploaded files?
$(function() { $("#file_upload").uploadify({ 'auto' : false, 'swf' : '/uploadify/uploadify.swf', 'uploader' : '/uploadify/uploadify.php', 'oncancel' : function(file) { removeuploadedfilefromtmp( file ); } });
});
// javascript(jquery ajax) function removeuploadedfilefromtmp( file ) { $.ajax({ url:'../your_website/removeuploadedfile', data: { file_name : file } }); } // php (or whatever else you're using) public function removeuploadedfile() { $files = scandir( "yoursourcepath/yourtempfile" ); foreach ( $files $file ) { if ( in_array( $file, array( ".", ".." ) ) ) { continue; } if ( $file == $_post['file_name'] ) { unlink( "yoursourcepath/yourtempfile" . $file ); break; } } }
everything in uploadify docs -> http://www.uploadify.com/documentation/.
the exact documentation might need:
http://www.uploadify.com/documentation/uploadify/oncancel/
Comments
Post a Comment