AnantLabs / ocupload

Automatically exported from code.google.com/p/ocupload
0 stars 0 forks source link

Upload works only once #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if this is an issue or an expected behavior, but we're trying to 
configure the upload to allow the user to re-upload a file.  This is 
useful if they upload the wrong file.

What steps will reproduce the problem? (This is a scaled down version of 
our code.
//********
$(document).ready(function() { ulSetup("upload"); });

function setupUpload(id) {
    $(document).ready(function() {
    $.ajax_upload(id, {
    action: 'Upload.ashx',
    onSubmit: function(file, extension) { onUploadSubmit(id, file, 
extension); },
    onComplete: function(file, response) { onUploadComplete(id, file, 
response); }
});

$('#' + id + ' .success-select a').click(function() { resetUpload(id); });
});
initUpload(id);
}
//********

What is the expected output? What do you see instead?
For the user to upload once, then reupload if necessary.

Original issue reported on code.google.com by exsu...@gmail.com on 6 Jan 2009 at 4:58

GoogleCodeExporter commented 9 years ago
Sorry, did not notice that someone had already submited this issue.

Original comment by exsu...@gmail.com on 6 Jan 2009 at 5:00

GoogleCodeExporter commented 9 years ago
Thanks to lizzsummerfield in the separate post, I found the solution to this.

Just add this to the onComplete function:

$('#' + formID).each(function() { this.reset(); });

Original comment by exsu...@gmail.com on 6 Jan 2009 at 9:06

GoogleCodeExporter commented 9 years ago
You can fix this by clearing out the input field in the onComplete handler.

$("input[@name='video']").val("");

Where 'video' is the name assigned in the upload method.

Original comment by mmjohns...@gmail.com on 16 Jan 2009 at 7:20