Howdy, Stranger!

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

controlling variables
  • i am using uploadify as an image uploader, i want the image to be able to be uploaded and then redirected to another page where you will see a thumbnail of the picture and be able edit the caption, description, etc... ... i am not interested on how to do it but only how to control variables from the files uploaded

    in a regular php uploader, i could put the uploaded file information into variables and redirect to another page and use those variables... with uploadify i am not sure how to accomplish this... i can't use uploadify.php to create variables to be used, after the upload, the user remains on the page uploadify is installed on... how can i take the file information and put it into variables and be redirected with the ability to call those variables

    i'm sorry i am new to javascript and i'm trying to understand it the best i can, if someone could help me achieve this
  • In the uploadify.php, you should be able to access the $_FILE variables at... $_FILES['Filedata']. 'Filedata' is the default name, yours can be different. You can also past regular information from a HTML form (link text inputs, check boxes, etc.) using the scriptData option. For example, i have this in my uploadify.php:


    $file_name = $file_name_temp = $_FILES['Filedata']['name'];
    $file_type = $_FILES['Filedata']['type'];
    $file_size = $_FILES['Filedata']['size'];
    $file_tmp = $_FILES['Filedata']['tmp_name'];

    $description = $_POST['description'];
    $name = $_POST['name'];



    One way to pass information over from the php side back to the javascript is through the "response" variable. Anything you echo/print from uploadify.php will come back as the "response" variable to options like onComplete. So in uploadify.php, do something like this:

    echo \"thumbnails.php?name=$file_name\";


    then, in your uploadify init add this option


    'onComplete' : function(event, queueID, fileObj, response, data) { window.location = response; },

    and once a file is complete, you would redirect to.. "thumbnails.php?name=$mountain.jpeg" or something. Note, I haven't tested the code, AND onComplete would only work for individual files, not multiple. But what you can do for multiple pictures is to take the response and store them in global javascript variables. Hope this helps.