Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upload script error reporting
  • Uploadify doesn't report report back errors that occur in the upload script but it is possible to display what's happening. Here's a very basic php implementation

    Add this to your upload script after "move_upload_to"

    switch ($_FILES['Filedata']['error'])
    {
    case 0:
    $msg = \"No Error\"; // comment this out if you don't want a message to appear on success.
    break;
    case 1:
    $msg = \"The file is bigger than this PHP installation allows\";
    break;
    case 2:
    $msg = \"The file is bigger than this form allows\";
    break;
    case 3:
    $msg = \"Only part of the file was uploaded\";
    break;
    case 4:
    $msg = \"No file was uploaded\";
    break;
    case 6:
    $msg = \"Missing a temporary folder\";
    break;
    case 7:
    $msg = \"Failed to write file to disk\";
    break;
    case 8:
    $msg = \"File upload stopped by extension\";
    break;
    default:
    $msg = \"unknown error \".$_FILES['Filedata']['error'];
    break;
    }

    If ($msg)
    $stringData = \"Error: \".$_FILES['Filedata']['error'].\" Error Info: \".$msg;
    else
    $stringData = \"1\"; // This is required for onComplete to fire on Mac OSX
    echo $stringData;


    add this to your onComplete override

    onComplete: function(a, b, c, d, e){
    if (d !== '1')
    alert(d);
    },


    Need a clearer explanation of what the error number means. Google it. It's all there.
  • Should the first code go into the "upload.php" ?

    There is no "move_upload_to"



    <?php
    // Uploadify v1.6.2
    // Copyright (C) 2009 by Ronnie Garcia
    // Co-developed by Travis Nickels
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $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\";


    ?>

  • What Trav meant to say is: place the code after 'move_uploaded_file'.
  • oops. Yes I did mean 'move_uploaded_file'
  • I'm going to have to play the supernoob card and say I've added both lines exactly as you recommended to try to determine my problem, but still nothing happens. I can upload a file, it gets to 100% then gives me an IO Error. Plus, clicking the close button after the error doesn't do anything. I have to refresh to get rid of the error. I think it might be a server issue, but I honestly can't tell.

    Here's what I've put in just in case...


    <script type=\"text/javascript\">
    $(document).ready(function() {
    $('#fileInput').fileUpload ({
    'uploader' : 'uploader.swf',
    'script' : 'upload.php',
    'cancelImg' : 'cancel.png',
    'auto' : true,
    onComplete: function(a, b, c, d, e){
    if (d !== '1')
    alert(d);
    },
    'folder' : '/uploads'

    });
    });
    </script>


    -and here's the upload.php too...


    <?php
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $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);

    switch ($_FILES['Filedata']['error'])
    {
    case 0:
    $msg = \"No Error\"; // comment this out if you don't want a message to appear on success.
    break;
    case 1:
    $msg = \"The file is bigger than this PHP installation allows\";
    break;
    case 2:
    $msg = \"The file is bigger than this form allows\";
    break;
    case 3:
    $msg = \"Only part of the file was uploaded\";
    break;
    case 4:
    $msg = \"No file was uploaded\";
    break;
    case 6:
    $msg = \"Missing a temporary folder\";
    break;
    case 7:
    $msg = \"Failed to write file to disk\";
    break;
    case 8:
    $msg = \"File upload stopped by extension\";
    break;
    default:
    $msg = \"unknown error \".$_FILES['Filedata']['error'];
    break;
    }

    If ($msg)
    $stringData = \"Error: \".$_FILES['Filedata']['error'].\" Error Info: \".$msg;
    else
    $stringData = \"1\"; // This is required for onComplete to fire on Mac OSX
    echo $stringData;


    }
    echo \"1\";
    ?>


    I hope there's someone that's able to help me out. I really love the idea of what this script is able to do, and would love to implement it in future projects. Thanks.
  • The echo '1' line is overwriting what ever is being echoed in stringData.

    I can understand what you've done wrong, and it's more my description of what to do with the code that has caused the problem. Seasoned programmers would pick it up straight away but Newbies would take the line "Add this to your upload script after "move_uploaded_file" literally.

    The above code needs to replace the echo '1' line in your upload script. So you will end up with
    [code=php]<?php<br />if (!empty($_FILES)) {
       
    $tempFile $_FILES['Filedata']['tmp_name'];
       
    $targetPath $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
       
    $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);
    }

    switch (
    $_FILES['Filedata']['error'])
    {     
         case 
    0:
                 
    $msg "No Error"// comment this out if you don't want a message to appear on success.
                 
    break;
         case 
    1:
                  
    $msg "The file is bigger than this PHP installation allows";
                  break;
          case 
    2:
                  
    $msg "The file is bigger than this form allows";
                  break;
           case 
    3:
                  
    $msg "Only part of the file was uploaded";
                  break;
           case 
    4:
                 
    $msg "No file was uploaded";
                  break;
           case 
    6:
                 
    $msg "Missing a temporary folder";
                  break;
           case 
    7:
                 
    $msg "Failed to write file to disk";
                 break;
           case 
    8:
                 
    $msg "File upload stopped by extension";
                 break;
           default:
                
    $msg "unknown error ".$_FILES['Filedata']['error'];
                break;
    }

    If (
    $msg)
        
    $stringData "Error: ".$_FILES['Filedata']['error']." Error Info: ".$msg;
    else
       
    $stringData "1"// This is required for onComplete to fire on Mac OSX

    echo $stringData;
    ?>[/code]

    It would also be a good idea to place an alert() function call into onError. The error that is displayed in the queue item is the last error that occurred. Usually there would be additional errors (HTTP) that would preceed the IO Error. You will only see these additional errors with an alert(). There is a code snippet in the Showcase Thread.
  • Thank you Travis for getting back so quickly regarding my problem. I hate to be one of these users but...

    I swapped out my original upload.php code with your recommendation and still no change in the script. I get the same result. 100% upload, no files, no error (except the red IO Error), and the inability to close red error box without having to refresh. I despise having to be babied, but I just barely know enough to get me by. Any more suggestions will be greatly appreciated. I'm going to post a demo onto my site to check out later tonight. Thanks.

    [attachment=0]error.jpg[/attachment]
  • You are going to need to add the code here http://uploadify.com/forum/viewtopic.php?f=5&t=12 It's possible you could be getting a HTTP error 412 which would mean you need to sort out your mod security. do a search on the forums for 2038 and you'll find some other solutions.
  • Thanks again Travis. The code helped me to determine that it is in fact a security issue.

    So now my next question...

    On my server I have my main domain then inside that a staging folder. This folder is password protected so I can run tests, maintain client sites, yadda yadda yadda... Inside this password protected folder is my testing folder which is where I want to be able to put Uploadify, but apparently because of it's parent folder security, it's causing issues. How can I get Uploadify to bypass the security password and upload content? Plus, will doing so open up any security holes that others can easily exploit? Thanks again for all your assistance!!
  • Flash doesn't support basic authentication. So you will need to move the upload script outside the password protected directories. If you still wish to maintain some level of security, then use sessions. Look at this post http://uploadify.com/forum/viewtopic.php?f=5&t=43
  • Awesome!

    Everything works wonders. You have been instrumental in helping me out.
    Where's my wallet... I gotta donate........... buy you guys a beer..............

    :mrgreen:
  • Hi

    The uploadify is such a great script, it works fine when i run in browser.

    I am currently implementing uploadify using Dreamweaver CS4 live view. In that i am using html file , inside i am using the uploadify script to upload a image in a specific directory.

    When i run the html file in the browser, it works as desired. But when i run in Dreamweaver CS4 live view, it says the "Adobe flash player has stopped a potentially unsafe operation"

    But when i change the html file as .php and run in Dreamweaver CS4 live view, it works.

    I am not sure about the issue with HTML - Dreamweaver CS4 - uploadify.

    If you can give some suggestion it would be great in completing my implementaion.

    Once again thanks for the great script.

    Regards

    sriram.s
  • Another distractionasics running shoes quickly escorted transport ships warships south, to support Taiwan to maximize the protection of Taiwan,
    the protection of the south channel.The army officers insisted on giving up Taiwan.Shanghai by the Navy to attack again,
    distraction from MBTthe main army landed in Shanghai, the birthplace of direct attack on the IDF and the most developed industrial center,
    completely destroyed the ability of the IDF and the core of the war most of the Chinese arms industry.And the IDF all the way north at this time,
    all theTory Burch Shoes way south to attack, troops must empty, the attack must be made lucrative Shanghai miraculous year.Achieve Weiweijiuzhao least,
    force the IDF withdrawal from Taiwan, so as to achieve a de facto lifting of the possible danger of Taiwan.
    However, Onitsuka Tiger shoespeople who strongly oppose the Navy, because since the Japanese can think of this, the IDF would not think of.Moreover,
    Shanghai has mbt shoes clearancesuffered attacks, the IDF must be preparedness.What is the Chinese people fly, he could blunder into such a situation,
    asics running shoes or MBT or Tory Burch Shoes or Onitsuka Tiger shoes or mbt shoes clearance
  • I got error 302 when using Uploadify. What helped me (after a lot of headache hours) is to add the following in .htaccess:

    SecFilterEngine Off
    SecFilterScanPOST Off

    Hopefully it works for others too!
  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • The ranking is calculated by NBA Dwight Howard Jerseys official mortar stores and online stores. The super star Kobe Bryant Kobe Bryant Jersey has been in All-Stars 11 times in his career, his No.24 Lakers jersey has Chris Paul Jerseys been the league's best-selling NBA jersey for two years which show his Chris Paul Jersey popularity absolutely. The one follows him is Cavaliers Deron Williams Jerseys forward Lebron James and Magic center Dwight Howard Dwight Howard Jersey. James wears the NO.23 jersey and the "Little Emperor" James is recognized as the only NBA player Deron Williams Jersey who has the qualification to inherit Jordan. Blake Griffin Jerseys Who is the favorite NBA player? There is no doubt that Kobe Bryant who Blake Griffin Jersey wearing NO.24 NBA jerseys of the Lakers. NBA officials announced NBA Shaquille O'Neal Jerseys jersey sales list of the 09-10 season. It shows that Kobe Bryant Shaquille O'Neal Jersey is always on the top of the list since last season. Fans love Kobe Ray Allen Jerseys the most can be shown by the sales of his NBA jersey. Ray Allen Jersey At the same time, James has high popularity because of his Paul Pierce Jerseys excellent strength and skills. And his jersey's Paul Pierce Jersey sales stand at the second place of the list. The leading star cheap nba jerseys of Miami Heat, Wade's jersey is also very popular. Michael Jordan Jersey The leading scorer in NBA, Carmelo Anthony's jersey Michael Jordan Jerseys sale has been increased stably. His stable excellent performance Dwyane Wade Jersey helps him own thousands' fans' love. Dwyane Wade Jerseys What's more exciting is that last season he NBA Boston Celtics #34 Paul Pierce Preschool Revolution 30 Replica Green Jersey unexpectedly break into the last five as the best newcomer of the sophomore champion show. NBA Boston Celtics #20 Ray Allen Revolution 30 Swingman Performance Green Jersey His NBA new jerseys sales even surpass the Miami Heat and super-star Dwyane Wade. NBA Cleveland Cavaliers #33 Shaquille O'Neal Swingman Basketball Wine Jersey Besides, the "big sharks" Shaquille O'Neal's jersey sales has never been on the top 10 list since June 2008, NBA New Orleans Hornets #3 Chris Paul Revolution 30 Performance White Jersey he joins in the Cavaliers. Nevertheless, in the first ten of the list, the sales volume of the top five is far NBA Orlando Magic #12 Dwight Howard Preschool Revolution 30 Replica Royal Blue Jersey more than that of the following players. This huge gap clearly shows the outstanding charm of the players such as Kobe.



  • Office 2010 loaded over my office 2003 with no problem. Office 2010 I loaded fast and all works like a charm. Microsoft Office 2010 Thanks, BDWS. This product is good for three computers. MS office 2010 I have two. On my laptop I already had the trial Microsoft Office version installed so installation Office 2010 key was simply entering the product code. But for my desktop which does not have high speed due to Office 2010 activation country living I needed the CD. Office 2010 download that is why I bought the CD Outlook 2010 rather then a downloadable version. Unfortunately the CD is unreadable. I will be Microsoft Office 2007 contacting the Office 2010 product key company about this but I shouldn't have to.