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.
  • I have seen a few posts for onComplete. And the functionality works great. But I am running into the issue that when the filepath is returned it is only returning a portion of the filepath, ie what I noted the filepath to be under folder.

    here is my upload jquery
    <script>
    $(document).ready(function() {
    $('#fileInput').fileUpload({
    'uploader': 'src/uploader.swf',
    'script': 'scripts/upload.php',
    'folder': 'uploads',
    'cancelImg': 'images/cancel.png',
    'buttonImg': 'images/browse-files.png',
    'width': 130,
    'onComplete': function(event, queueID, fileObj, response, data) {
    $('#filesUploaded').append('<a href='+fileObj.filePath+'>'+fileObj.name+'</a><br>');},
    'multi': true
    });
    });
    </script>


    This works fine, here is my php upload script.
    <?php 
    $masterFolder = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $newDir = $masterFolder . date('m-d-Y h-i-s A') . '/';

    // Uploadify v1.6.2
    // Copyright (C) 2009 by Ronnie Garcia
    // Co-developed by Travis Nickels
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $newDir;
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

    // 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 \"1\";
    ?>


    And it works great, but as I said when it returns the filepath variable I only get uploads/filename.ext, but what I want is to get uploads/$newdir/filename.ext.

    Any help would be appreciated.
  • filePath is an assumption that you are only using the folder option to set the directory you want the files saved to. It simply returns the base folder + the value set in the folder option. If you use a different structure ie basefolder/$newdir/uploads you need to echo this new path in your upload script and retrieve the value using the response variable passed through onComplete. There is no other way for flash to know what you are doing in the upload script. It can not know the directory structure you are using. So if you change the upload script from what is set as default, then you must use the response functionality if you need that information.

    Same as when you save the file under a different name to what was selected ie one generated using a random sequence + .ext. Flash does not know what you have done in the upload script and so you will need to echo the new name and retrieve it in onComplete with the response variable.

    If you want to use filePath, in your case instead of setting it in the upload script. You could set the folder using fileUploadSettings before the upload starts. You'll need to create a start() that you startUpload button points to.

    You then can retrieve the users current time using javascript or the servers time using a POST method via a PHP script, Once you have that info you can set the folder using fileUploadSettings, and then start the Upload. This will give you one folder for entire queue. If you want an individual folder for each uploaded file then you can put this whole function into onSelect. That way as each file is selected it will be given it's own folder and uploads will start automatically.
  • After looking more into it moments after my post I realized there was the commented out line, that was all I needed to adjust to achieve what I was looking for. But now I'm trying to add in a conditional statement for an image on the response, but I can't seem to get the proper file type to return.

    <?php 
    $masterFolder = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $newDir = $masterFolder . date('m-d-Y h-i-s A') . '/';

    // Uploadify v1.6.2
    // Copyright (C) 2009 by Ronnie Garcia
    // Co-developed by Travis Nickels
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $newDir;
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

    // 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);
    }
    $relDir = str_replace(' ', '%20', substr( $newDir, 21, -1) . '/' . $_FILES['Filedata']['name']);
    echo '<div id=\"File\"><strong>'.$_FILES['Filedata']['name'] . '</strong><br />Location: <a href=\"'.$relDir.'\" target=\"_blank\">http://'.$_SERVER['SERVER_NAME'] . $relDir. '</a><br />File Type: '. $fileType . '</div>';
    ?>


    That is my code at this point, of course $fileType, theoretically should be $_FILES['Filedate']['type'], but that just returns application data information.
    My condition would be to append an icon to the response. Something of the sort below, I have no problem writing the statement, I just need to find out how I can get the correct file type to come accross on the script page.

    if ($fileType == image) {
    echo <img ...
    } else if($fileType == pdf) {
    echo '<img ..
  • To use $_FILES['fileData']['type] check out this blog post http://aarronwalter.com/2006/12/14/displaying-file-icons-for-downloads-with-php/ it shows exactly how to use it for the application you want.

    Alternatively you can extract the .ext and perform your conditional on that.