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.
ScriptData and uploadify.php PHP
  • Hi there!

    I'm new to uploadify and therefore a newbie on this forum. Whilest implementing the uploadify script I came across several issues that requires some help from a "pro."

    I would like to use Uploadify in such a way that the filename is renamed. The new name will consist two variables that are send to uploadify by the scriptData option. My code will look as followed:


    <link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/uploadify/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="/uploadify/swfobject.js"></script>
    <script type="text/javascript" src="/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    $('#someID').uploadify({
    'uploader' : '/uploadify/uploadify.swf',
    'script' : '/uploadify/uploadify.php',
    'cancelImg' : '/uploadify/cancel.png',
    'folder' : '/media',
    'scriptData': {'id':'<?php echo $UserId;?>','filenumber':'<?php echo $filename_new;?>'},
    'onAllComplete' : function(event,data) {
    document.getElementByID('AddMedia').submit();
    }
    });
    });
    </script>


    In my the body section of my HTML I have the following form:


    <form id="AddMedia" action="/page/media/" method="POST">

    <input id="someID" name="someName" type="file" />
    <input type="hidden" name="stap" value="2">
    <input onclick="$('#someID').uploadifyUpload()" type="image" src="/images/buttons/bevestig.png" alt="Bevestig" value="Submit" />


    In order to process the data in uploadify I have modified the uploadify.php file to the following:


    if (!empty($_FILES))
    {
    $posted_userid = htmlspecialchars($_POST['id']);
    $filenumber = htmlspecialchars($_POST['filenumber']);

    if(is_numeric($posted_userid))
    {
    if(is_numeric($filenumber))
    {
    $filename_new = $posted_userid."_".$filenumber;
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
    //$targetFile = str_replace('//','/',$targetPath) . $filename_new.".".end(explode(".",$_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'],'',$targetFile);
    //} else {
    echo 'Invalid file type.';
    //}

    }
    else
    {

    }
    }
    else
    {

    }
    }


    Now comes the problem, the file itself isn't uploading anymore. The CHMDR are set to 0755, so the permissions are set correctly.

    Any help, feedback and or comments will be highly appreciated.

  • The user and all related content has been deleted.
  • brakzijn said: The CHMDR are set to 0755, so the permissions are set correctly.


    You sick or something 0755 means Means that you can't write as a normal internet user or a group
    So,
    use 0766 it works 100% fine