Uploadify: changing scriptData with dropdowns

Uploadify is a pretty awesome jQuery/flash uploader. It’s made even more awesome by the stuff you can do with it on the fly.

For example, if you want to pass a variable chosen from a dropdown via the uploader, you can use uploadifySettings() to do so. Some people appear to have problems with this part, so here’s how I did it. (I’m not going to show you all the settings, since the docs give you a pretty good idea how to set it up. )

Say you have a dropdown in your form with the id of ‘upload_type’:

<select id="upload_type" name="upload_type">
<option value="1">First type</option>
<option value="2">Second type</option>

In your jQuery $(document).ready function (but outside the $(‘#upload’).uploadify function), put something like this:

$('#upload_type').change(function() {
var type_val = $(this).val();
$('#upload').uploadifySettings("scriptData", {"upload_type" : type_val});

Which means “Whenever the form field identified with ‘upload_type’ changes, update the ‘upload_type’ variable in scriptData if it exists; if it does not already exist in scriptData, add it.”

Note: I’ve only tried this in Uploadify 2.1.4.


  1. Sickboy

    Thanks for the the tip. Its working fine. You can even use a textarea, a checkbox, radio, or text input field.

    Thanks !

Leave a Reply

Your email address will not be published. Required fields are marked *