How to pass fileObj data with Uploadify to PHP
I'm using Uploadify for my file uploading:
$('#file_upload').uploadify({
'scriptData' : {'creationDate':'test1','modificationDate':'test2'},
'onSelect' : function(event,ID,fileObj) {
console.log(fileObj.creationDate.time);
//alert('The file ' + fileObj.name + ' was added to the queue.');
}
});
From the above code, my OnSelect event can show the creationDate of the file as I have logged fileObj.creationDate.time
But I would like to pass this value to my backend when I start the upload process. I have the scriptData option, but I am not sure how to pass that creationDate since I do not have the fileObj in this case.
Anyone know what I can do to pass the creation开发者_运维问答Date to my backend script at the same time that the file gets uploaded?
Try putting this in your onSelect handler:
$('#file_upload').uploadifySettings("scriptData", {'creationDate': fileObj.creationDate.time});
精彩评论