I am uploading file using jQuery uploadify plugin. Each time I upload a file, a hidden field is created in the form with uploaded file path on server. When I submit the form, I store this file path in database by getting it from hidden field. It is working for me. One problem is that I am hard coding form object in onComplete
function of uploadify.
Here is my code:
jQuery:
$('.FileUpload').uploadify({
'uploader' : '/uploadify/uploadify.swf',
'script' : '/uploadify/uploadify.php',
'cancelImg' : '/uploadify/cancel.png',
'folder' : '/uploads',
'auto' : true,
'queueID' : 'fileQueue',
'removeCompleted':false,
'onComplete' : function(event, ID, fileObj, response, data) {
// It is hard coded here. It may create probelems
// if there are multiple file upload buttons.
// How can I do this with '$(this)' keyword or something
$('.SingleFileUpload').parents('form').append( '<input type="hidden" name="uploaded_file" value="' + response + '">' );
}
});
How can I get only form who's file browse button is clicked in onComplete()
function. I think you got my point?
Thanks
I think it should work if you replace $('.SingleFileUpload')
with $(event.target)