Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

FileUploadSetting
  • Before everything, I really wish to thank you, you did a great job with uploadify!

    But, I post this here because I thik I found a bug, even if I could fix it:
    When using the function FileUploadSettings to update the scriptData setting, you can't put an object as a parameter ({parameter1 : 'value' , parameter2 : 'value2' }), you actually have to write an url encoded object and start the string with "&" (&parameter1=value&parameter2=value2). I don't actually know if it is really a bug.
    But I wish I could use fileUploadSetting this way
    $('#someId').fileUploadSetting('scriptData',\"{parameter1 : 'value' , parameter2 : 'value2' }\")

    instead of
    $('#someId').fileUploadSetting('scriptData',\"&parameter1=value&parameter2=value2\")

    This seems more logic to me

    it could easily be done by modifying the javascript function:

    fileUploadSettings:function(settingName, settingValue) {
    $(this).each(function() {
    document.getElementById($(this).attr('id') + 'Uploader').updateSettings(settingName,settingValue);
    });
    }

    and add a condition:

    fileUploadSettings:function(settingName, settingValue) {
    $(this).each(function() {
    /*
    Begining modifications
    */
    if(settingName == 'scriptData')
    {
    var scriptDataString = '&';
    datas = eval(settingValue);
    for (var name in datas) {
    scriptDataString += '&' + name + '=' + datas[name];
    }
    document.getElementById($(this).attr('id') + 'Uploader').updateSettings(settingName,scriptDataString);
    }else
    /* End of upgrade */
    document.getElementById($(this).attr('id') + 'Uploader').updateSettings(settingName,settingValue);
    });
    }


    I didn't test this code, I just put it here as a sugestion...


    My version jquery.uploadify version 1.6.2 MIT

    Thank you again!
    Dedeisep
  • This has been changed and improved in the next version to use objects in scriptData inside fileUploadSettings.

    Currently any changes to scriptData will remove any settings that aren't included in the update string, even if they are not changed. It has been to changed to update the setting if it exists or add the settings if it doesn't.
  • Ok I thought I had the lastest version...
    Nevermind, thx again!
  • 1.6.2 is the latest release. The changes I mentioned haven't been released yet they will be in version 2
  • The uploadify is really nice plug-in. but the scriptData cannot pass the data to next page, the code is
     $.ajax({
    type:\"GET\",
    url:\"session_name.php\",
    success:function(msg){
    alert(msg);
    var name=msg;
    $('#fileInput').fileUploadSettings('scriptData', \"&name1=value1&name2=value2\");


    }
    });

    I tried many times, the name1and name2 cannot be received by $_GET['name1'] and $_GET['name1'] ,but why ? it cannot be used in ajax? expecting the answer.....
  • that fails because file uploads are a POST not a GET, you should be reading from $_POST or $_REQUEST to see the submitted values