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.
Random file name
  • Here is the code to generate a random file name on each upload, to avoid overwriting previous files. ->

    File: upload_name.php
    [code=php]
    <?php<br />
    if (!empty($_FILES)) {
       
    $tempFile $_FILES['Filedata']['tmp_name'];
       
    $targetPath $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
       
       
    $ext pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);  //figures out the extension
       
       
    $newFileName md5($tempFile).'.'.$ext//generates random filename, then adds the file extension
       
    $targetFile =  str_replace('//','/',$targetPath) . $newFileName;

       
    move_uploaded_file($tempFile,$targetFile);
    }

    if (
    $newFileName)
       echo 
    $newFileName;
    else 
    // Required to trigger onComplete function on Mac OSX
       
    echo '1';

    ?>
    [/code]
  • I figured out that you can set php highliting for the code block like so:
    [code=php]<?</span>php

    if 
    (!empty($_FILES)) {
       $tempFile = $_FILES['Filedata']['tmp_name'];
       $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
       
       $ext 
    = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);  //figures out the extension
       
       $newFileName 
    = md5($tempFile).'.'.$ext; //generates random filename, then adds the file extension
       $targetFile =  str_replace('//','/',$targetPath) . $newFileName;

       move_uploaded_file($tempFile,$targetFile);
    }
     [/code]

    instead of [code] you put [code=php]...for future reference...
  • hi

    i'd like to share my way in generating names

    [code=php]$newFileName = md5(uniqid(rand().time(), true)) . substr($_FILES['Filedata']['name'], strrpos($_FILES['Filedata']['name'], ".")); [/code]

    good luck ;)
  • if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION); //figures out the extension

    $newFileName = md5($tempFile).'.'.$ext; //generates random filename, then adds the file extension
    $targetFile = str_replace('//','/',$targetPath) . $newFileName;

    // Uncomment the following line if you want to make the directory if it doesn't exist
    // mkdir(str_replace('//','/',$targetPath), 0755, true);
    //echo "$tempFile => $targetFile";
    move_uploaded_file($tempFile,$targetFile);

    hey it did not work for me until i took out the } at the end

    Just a little tip for people who may have used it and it has not worked.
  • Hi!

    Where I have to put the code? Thanks!

    :D
  • The quote overwrites what is currently your upload_name.php file.
  • Sir, I'd like to read more of your articles.

    -------------------------------------------------------------------------------
    Fashion Jewelry Gift