This forum is a community forum meant for users of the plugin to collaborate and help solve issues with implementation, etc. Unfortunately, as the creator of the plugin, I do not have much time to attend to every request here as this is only a side project and I must work a full-time job to provide for my family. This is how I keep the Flash version free and the HTML5 version low cost.
UploadiFive 1.1.1 has been released which includes a small fix for added support on touch devices including iOS 6 devices.
  • Hey everyone, I'm having some serious issues with passing data from the upload form to uploadify.php

    No matter what I do I cannot pass a variable over there. I even tried setting scriptData to a static value so:
    'scriptData': {'auctionID':'test'}
    Still couldn't get the value using: POST, REQUEST, or GET. The uploading function works fine, just cannot seem to pass a variable.
    I also tried using sessions with absolutely no luck. I learned through the forums and searched on google and just cannot figure this one out. Hopefully you guys can help, I'd really appreciate it.



    Webform:
    <div id=\"custom-demo\" class=\"demo\">
    <h2>Photo upload</h2>
    <script type=\"text/javascript\">
    $(function() {
    $('#custom_file_upload').uploadify({
    'uploader' : 'http://www.xxxxxxxxxxxx.com/xxxx/uploadify/uploadify.swf',
    'script' : 'http://www.xxxxxxxxxxxx.com/xxxx/uploadify/uploadify.php',
    'cancelImg' : 'http://www.xxxxxxxxxxxx.com/xxxx/uploadify/cancel.png',
    'folder' : '/uploads',
    'method' : 'POST',
    'multi' : true,
    'scriptData' : { 'auctionID': '&lt;?php $auctionID;?&gt;'},
    'auto' : true,
    'fileExt' : '*.jpg;*.gif;*.png',
    'fileDesc' : 'Image Files (.JPG, .GIF, .PNG)',
    'queueID' : 'custom-queue',
    'simUploadLimit' : 3,
    'removeCompleted': false,
    'onSelectOnce' : function(event,data) {
    $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
    },
    'onAllComplete' : function(event,data) {
    $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
    alert(data.filesUploaded + ' files uploaded successfully!');
    }
    }); });
    </script>


    uploadify.php
    if (!empty($_FILES)) {

    $auctionID=$_POST['auctionID'];

    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . '/'.'usindustrial'.'/'. $_REQUEST['folder'] . '/';
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

    // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
    // $fileTypes = str_replace(';','|',$fileTypes);
    // $typesArray = split('\|',$fileTypes);
    // $fileParts = pathinfo($_FILES['Filedata']['name']);

    // if (in_array($fileParts['extension'],$typesArray)) {
    // Uncomment the following line if you want to make the directory if it doesn't exist
    // mkdir(str_replace('//','/',$targetPath), 0755, true);

    move_uploaded_file($tempFile,$targetFile);
    echo str_replace($_SERVER['DOCUMENT_ROOT']. '/'.'usindustrial'.'/','',$targetFile);

    //here we have to take a substring because when we request from the server 'DOCUMENT_ROOT' it return
    //a bunch of bullshit for the path that we can't use, so we just trim off the first 41 characters of that bullshit leaving us with uploads/yamom.jpg ect.
    $subStrFilePath = substr($targetFile,41);

    $query = ("INSERT INTO images (path, auctionID)
    VALUES
    ('$subStrFilePath', '$auctionID')");
    $results = mysql_query($query, $con);

    mysql_close($con);
  • I think the problem is that you're not actually echoing the static value.

    <?php echo $auctionID; ?>
    vs.
    <?php $auctionID; ?>

    If you're trying to do something dynamic in there, use the .uploadifySettings method to set the value before the upload begins.
  • Thanks for the reply Ronnie.

    I tried even hard coding in a value such as: 'scriptData' : { 'auctionID': 'TESTVALUE'}.

    on the REQUEST,GET,or POST still nothing comes through. Do you think I need to configure my php.ini file on the webserver or something? No one else seems to be having the same issue..
  • Anybody have any ideas?
  • I wonder if the problem is I'm not using the root paths, I'm using a sub directory.
  • i'm having the same problem here, i think that i'm figuring something out, but i still don't reach success yet.

    just one funny fact, in IE these errors does not occurs with me, only in FF Chrome and opera.
  • Keep me posted if you figure something out, I'm at a loss.
  • It's simple really. Change
    { 'auctionID': '&lt;?php $auctionID;?&gt;'},
    to
    {auctionID: '&lt;?php $auctionID;?&gt;'},
    notice the difference? 'auctionID' to auctionID
  • Still no luck, I'm willing to paypal someone $35 USD to who ever can figure out what the issue is here.
  • Oh sweet merciful jesus, I finally figured it out. Thanks any ways guys
  • @fatb0t, could you share your solution with me as i am having the same problem as you.
  • @fatb0t, i figured it out as well
  • Somebody could post how the problem was solved? I'm stuck with the same issue :S thanks in advance