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.
My Implemenation! Woohoo!
  • Hi,

    After getting the thing to work (there was typo in the link to the js file - doh!) I implemted this into a small internal project management system we use at work (users upload a file before adding a comment). Users can comment of projects and need to attach one or multiple files (or none obv.) to a comment. So when a user views a comment there will be a link to the file to download. Sounds simple, but yesterday I was at my wits end trying to get this script to work.

    I'm aware it's not as advanced as some showcased here, but I thought my example may help others - as I imagine associating a file with a certain item is quite common. Also, until I read quite a few threads the below wasn't immediately obvious. :?

    Firslty, here's the index page code:


    <?php session_start();
    $_SESSION['COMMENT_ID'] = '33';
    ?>
    <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
    <html xmlns=\"http://www.w3.org/1999/xhtml\">
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
    <link rel=\"stylesheet\" type=\"text/css\" href=\"css/uploadify.css\" />
    <script type=\"text/javascript\" src=\"js/jquery-1.3.2.min.js\"></script>
    <script type=\"text/javascript\" src=\"js/jquery.uploadify.js\"></script>
    <script type=\"text/javascript\">
    $(document).ready(function() {
    $('#theuploadfield').fileUpload({
    'uploader': 'flash/uploader.swf',
    'script': 'upload.php',
    'folder': './uploads',
    'displayData': 'percentage',
    'buttonText': 'Choose File(s)',
    'buttonImg':'img/butupload.gif',
    'width': 172,
    'height': 84,
    'multi': true,
    'scriptData': {'COMMENT_ID': '<?php echo $_SESSION['COMMENT_ID']; ?>'},
    'cancelImg': 'img/cancel.png'
    });

    });
    </script>
    <title>Upload test</title>
    </head>
    <body>

    <input type=\"file\" id=\"theuploadfield\" name=\"theuploadfield\" /><br />
    <div id=\"toolbar\">
    <img src=\"img/add.png\" alt=\"Add\" class=\"aligned\" /> <a href=\"javascript:$('#theuploadfield').fileUploadStart();\">Upload Files</a> |
    <img src=\"img/cancel_all.png\" alt=\"Cancel\" class=\"aligned\" /> <a href=\"javascript:$('#theuploadfield').fileUploadClearQueue();\">Clear Queue</a>
    </div>
    </body>
    </html>


    The scriptData is simply meant as an example here. In the production system the script data would be the comment ID that I would get and set via a database query, here i have simply set a static number.

    Have amended the upload.php slightly to insert the file name, file extension, upload date and comment id into a table (I'm using a simple database class I wrote to mnimize the amount of code I written). To get the script data variables I used php's GET function as the script data is sent via the get method.


    <?php
    require(\"classes/db.class.php\");

    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $ext = strtolower(substr($_FILES['Filedata']['name'], strrpos($_FILES['Filedata']['name'], '.') + 1));
    //$filename = md5(basename($_FILES['Filedata']['tmp_name'])).'.'.$ext;
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

    //upload
    move_uploaded_file($tempFile,$targetFile);

    $thefilename = $_FILES['Filedata']['name'];

    //assign script data to a variable
    $theID = $_GET['COMMENT_ID'];

    //save file to db
    $db = new mysqldb();
    $db->select_db();
    $sql = sprintf(\"INSERT INTO rob_files (fileName, fileExtension, DateTimeUploaded, CommentID) VALUES ('%s','%s', NOW(), '%s')\",
    mysql_real_escape_string($thefilename),
    mysql_real_escape_string($ext),
    mysql_real_escape_string($theID)
    );
    $result = $db->query($sql);
    $db->kill();
    }

    //Would un-set the session here usually, but need to use the comment id for when a user actually posts the comment.
    //unset($_SESSION['COMMENT_ID']);
    echo \"1\";
    ?>


    That's it really, only other thing i did was use a nice php directory indexer for the uploads directory:

    image

    Here's what the saved data looks like (ignore the blank dates I was testing then):

    image


    I want to display a confirmation message after uploading E.g. "3 files uploaded!", but can't figure it out, if anyone could make some suggestions it would be great :)
  • I want to display a confirmation message after uploading E.g. "3 files uploaded!", but can't figure it out, if anyone could make some suggestions it would be great :)


    Use 'on Complete' or 'onAllComplete' to show a div that contains the message you would like to show. Something like this (beeing 'fileUploaded' the id of your div):

    onComplete   : function(event, queueID, fileObj, reposnse, data) {
    document.getElementById('fileUploaded').style.display = 'block';
    }


    Nicte
  • You can also do a really cool message that flashes then fades:


    onComplete : function(event, queueID, fileObj, response, data) {
    $('#fileUploaded').html(data.filesUploaded + ' files were successfully uploaded.');
    $('#fileUploaded').show().animate({'display':'block'},3000).hide(500);
    }


    fileUploaded would be the id of the success message.
  • rallport,

    That directory lister you have looks really nice - would you mind sharing?

    :)
  • tomreno said:
    rallport,

    That directory lister you have looks really nice - would you mind sharing?

    :)



    Sure, http://www.celerondude.com/php-indexer :) Just drop the index.php into the directory and away you go :)
  • Hi.. I did try to see if it is really working but the thing is that the files are uploaded to the directory but not in the database.. this is my code:
    Please help. thanks in advance...

    <?php
    // Uploadify v1.6.2
    // Copyright (C) 2009 by Ronnie Garcia
    // Co-developed by Travis Nickels
    include('config/config.php');
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

    //upload
    move_uploaded_file($tempFile,$targetFile);

    $thefilename = $_FILES['Filedata']['name'];

    //save file to db
    $sql = sprintf("INSERT INTO tblrequisition (rs_file) VALUES ('%s')", mysql_real_escape_string($thefilename));
    $query = mysql_query($sql);
    }
    echo "1";
    ?>
  • nice, I may implement something similar, now that I've seen how nice it looks :D

    One suggestion - I see you are simply looking for a period in the filename to determine the extension. For a filenames like "timesheet-5.22.10.zip," this would cause a problem. A better solution would be to use the php pathinfo function:

    $ext = pathinfo($filename, PATHINFO_EXTENSION);

    Otherwise, nice and clean implementation!
  • Todays,more and more people believe that simple is fashion,the design style of Michael Kors Bag is tend to focus on the generous and simple appearance.With Michael kors handbags you will be more elegant and charming.We offer Michael kors handbags, Michael kors satchel,Michael kors purses,hamilton michael kors etc on Michael kors store online.You can easy find a bag that suits your own style and taste.
    Now,All the Michael kors bags sale with a big discount at our Michael kors outlet and no sale tax.Here is the ideal place for you to buy Cheap Michael Kors Bags with free shipping all over the world.Enjoy shopping!
  • Personal mantra for the day: I do not need another cambridge satchel. Repeat as needed. What brought on this moment of madness? I made the mistake of discovering the Cambridge bag, which masquerades as a Cambridge Satchel Leather bag when it’s not serving as the ultimate Cambridge Satchel Classic bag. I love it all: the dusty red color, the magnetic closure, the smooth leather, the slightly textured finish that keeps it from looking plain. It’s just beautiful, and so emblematic of what cambridge satchels does best. Shop Cambridge satchel offer better than Cambridge Satchels Co, you could save 40% money.

  • For those of us with Suzuki Outboards Sale a reasonable fear of the ocean, this is a worst case scenario: Last week, Dan Suski, 30, and his sister Kate Suski, 39, chartered a fishing boat in St. Lucia. Things were going fine, despite the rough seas, and the siblings even managed to hook a 200-pound marlin. They were battling the giant fish when water rushed onto the boat and flooded its engine room. As the captain radioed for help, another surge Yamaha 4 Stroke Outboard of water swamped the boat. At that point, the captain tossed the Suskis life jackets and ordered them into the ocean.


    "He said, 'Jump out! Jump out!'" Kate Suski recalled in a telephone interview Thursday with The Associated Press.


    The captain and the first mate soon joined them and Yamaha 150 outboard, five minutes later, the boat sank, leaving the group stranded at least eight miles from shore. The group stayed put for the first hour, awaiting rescue. No one came. The group started to swim, but the rough waves caused the Suskis to became separated from the captain and first mate. "We would just see swells and gray," Dan Suski said.


    Hours went by. A helicopter and search plane arrived but failed to notice the two siblings. They continued swimming. Eventually, the sun went down.


    "There's this very real understanding that the situation is Yamaha outboard motors dire," Kate Suski said. "You come face-to-face with understanding your own mortality ... We both processed the possible ways we might die. Would we drown? Be eaten by a shark?"


    Neither could stop thinking about sharks. "I thought I was going to vomit I was so scared," Kate said.


    Finally, after 14 hours, they came within 30 feet of land only to discover the coast was covered with cliffs, making it impossible to climb from the ocean. “We knew we would get crushed,” Kate said.


    They kept swimming, Yamaha outboards Sale finally finding a small stretch of sand. Once ashore, they collapsed before again going into survival mode to avoid hypothermia. They hiked into the island and huddled together, covering themselves in grass and brush to stay warm. They spent the night like that, only moving when the sun rose. It took three hours before they found a farmer, who called police and gave them water and crackers.


    They would later find out that the captain and first mate had been rescued after 23 hours in the ocean.


    Despite dehydration, severe tendonitis and Honda outboards Sale cuts over their feet and back, the couple didn't blame anyone for the ordeal.


    "We are so grateful to be alive right now," Kate Suski said. "Nothing can sort of puncture that bubble."