I\'m using uploadify on a page that allows a user to upload images as well as a category field in which to send those images. Now, I see that uploadify provides a \"scriptDa
you would need to fetch the current state of the user's input via one of uploadify's callback hoock: onOpen or onSelect . See their documentation for the right one. I guess onOpen is more reliable as it will check the current state of user input everytime an upload is started. Still, you might need to disable other user inputs while an upload is ongoing, or still require the user to submit the form, otherwise any user input done after the last upload has started will be lost.
Anyway, I found this on their forum, which i would put on a onOpen
callback:
$('#fileInput2').uploadifySettings(
'scriptData',
{'ext':$('#dirTimeStamp').val(), 'ext2':$('#txtEmail').val()}
);
A final implementation would be (using the demo code) :
<input id="fileInput" name="fileInput" type="file" />
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader' : 'uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : 'cancel.png',
'auto' : true,
'folder' : '/uploads',
'onOpen' : function(){
$('#fileInput').uploadifySettings(
'scriptData',
{'ext':$('#dirTimeStamp').val(), 'ext2':$('#txtEmail').val()}
);
}
});
});
// ]]></script>
Beside put the code to update the scriptData inside onOpen, you can also do it before starting upload. This can be done if you set auto to false, so you will need to call uploadifyUpload()
manually.
Take a look at accepted answers in this thread.