Flash File Uploader v3.11 – Details Bugfix

uploader.jpg

Due to old code in the the index.php file, the details checkbox wasn’t displaying file information and thumbnails for file lists in custom directories. This has been fixed and re-uploaded in a new .rar file of this project. The link is the same as the last one.

Comments and feedback always welcome. Thanks again, Mike, for the assistance and to [d]online commenter, TimD, for pointing this to my attention.

25 Replies to “Flash File Uploader v3.11 – Details Bugfix

  1. Don,
    Thanks again for the great uploader and for helping me with my questions a few weeks back. It is working beautifully. I have another question if I may. What would be entailed to add an option to delete files after they are uploaded. My thought was to have on the chart of uploaded files a checkbox or a button that would allow you to delete one of the files. Is that possible or prudent? Thanks for any help you could offer.
    Tim

  2. Don,
    Thanks for pointing me in the right direction. I’ll give it a whirl and see where I get. Thanks

    Tim

  3. If you’re only having problems uploading larger files, this may have something to do with the PHP.INI settings or maxupload settings imposed by the host.

    The uploader will produce errors if the file was restricted after it was copied to the server. Sometimes this happens if the file size is greater than the max filesize, memory or post max settings of the server. The uploader will attempt to upload the file to a temporary folder and the PHP will then copy the file over to your desired folder (see information about custom directories). If PHP recognizes that the file is too large, or the server settings are too low/small, the file won’t be able to be copied to the custom directory. Check your php.ini file or try uploading an extremely small file to see if this is the issue you’re experiencing. It may also have something to do with the permissions PHP needs to copy the file to the new location. If your uploaded file is not being moved (due to size or permission constraints), you’ll get an error.

    Run a Google search for increasing upload size and memory limits in your PHP.INI file. Here are two links which (pertain to Drupal, but) may help you do this:
    http://drupal.org/node/97193
    http://drupal.org/node/29268

    Hope this helps.
    -Don

  4. Does this work with https ? I’m trying to trace my problem (the website works fine on non-https, but it’s in a different spot) and the only error message I have is onIOError: FileName.ext that pops up in a js message box after you click upload. Server is PHP/Apache on Debian. Client is Firefox Windows and Linux and IE on Windows (and Safari eventually, but I haven’t tested yet).

    Other then that, I love this item. It works great.(Except now or course)

  5. Ok, my mistake. It works on IE on Windows and Firefox on Linux. It still however does not work on Firefox on Windows.

  6. Ok, I’m sorry. I figured it out. Flash uses IE\’s SSL certificate db, and my cert is self signed(well, signed by my ca). Adding the ca cert to IE fixed it. Looks like I’ll need to make my boss shell out some money for a real certificate(and domain for that matter)… Thanks anyway, and again you have a wonderful app here.

  7. Hi Don,

    Thanks for the great flash. It works normal in the sample code. But when I try to add upload feature for a logged in user in my app, it doesn’t work anymore.

    The reason is, my app check if a request belongs to an authenticated user by checking a $_SESSION[‘username’], if user is authenticated, he is allowed to upload. The upload request from flash doesn’t include cookie info, as I try the var_dump($_FILES) and var_dump($_COOKIE), the first one show file upload information, the second one is an empty array. Php session need cookie, of course I know it can work with SESSION_ID attach to the URL, but I prefer to store SESSION_ID in cookie.

    So can you help to update the flash so it can include Cookie information with it.

    My comment is little bit long :). I hope you have enough information.

  8. The index script (with embedded flashuploader) will hold session data, but the upload script won't carry the session.
    it's just the nature of the beast.
    when you embed, try creating a flashvar (global) that contains the session id:

    ex: (index.php)
    fo.addVariable("auth_user", ""); //or $_COOKIE['username']; or SESSION_ID

    …you can pass this from flash to upload.php in the URL search (as a GET var):

    ex: (uploader.fla)
    item.upload("upload.php?d=true"+...+"&auth_user="+_root.auth_user);

    …on the handler side, you can do whatever further validation you need or use this new value as a path for file storage:

    ex: (upload.php)
    $filepath = getcwd() . "/files/" . $_GET['auth_user'] . "/";
    if(!file_exists($filepath)) mkdir($filepath,0755); //0777 for world write (!)
    if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $filepath . $_FILES['Filedata']['name']))

    This would essentially do the following:
    If the flash uploader page is called while the user is authenticated, then "auth_user" is passed to the flash,
    which instructs the PHP where to upload the file—in a subdir of "files" named for the user.

  9. Hello,

    I am using your Flash Upload script inside of a folder secured by .htaccess method.

    It was working at first but now when the upload completes in FireFox and Safari I get a 401 error and using Google Chrome a authentication dialog pops up.

    Either way the files are not uploading.

    Any ideas on how to avoid this?

    Thanks,
    ian

  10. I try to add bellow line to index.php
    fo.addVariable(“PHPSESSID”,”{$PHPSESSID}”);
    but it seems that I have to change the upload.fla file so the request can be attached with new parameter. Is that true? Anyway, it’s a little stuck for me because I am not familiar with flash code, build process.

    If you can attach all available COOKIE stored in browser to POST request header (include PHPSESSID one which need to initialize $_SESSION), it’s really cool for me. My authentication library use $_SESSION as its backend.

    Thanks.

    – Tuan Ngo.

  11. Ian, I’m taking a look into this and will get back to you. Basic .htaccess probably isn’t the best solution if you’re trying to protect these files, but it’s what you require, I’ll poke around to see what I can come up with.

    Tuan, Did you try the suggestion I provided in comment #11 above?

  12. Ian, just learned that you need the PHP INI sets in the .htaccess file in order to fix those errors. Try this:


    AuthName "Restricted Area"
    AuthType Basic
    AuthUserFile /var/www/upload/.htpasswd
    AuthGroupFile /dev/null
    require valid-user
    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 200
    php_value max_input_time 200

  13. Tuan, to change the Flash file to pass the PHP Session ID to upload.php, just modify the end of line 153 of the Flash file and republish:


    ...&dir="+_root.upload_dir);

    …becomes…

    ...&dir="+_root.upload_dir+"&PHPSESSID="+_root.PHPSESSID);

    Then republish the Flash. If you don’t have Flash, let me know and I’ll send you an updated .SWF.

  14. Don.

    I also learned that Flash does not support http auth.

    Should I put those lines in my .htaccess or my php.ini file?

    Thanks
    ian

  15. Sorry, that’s an example of an entire .htaccess file. All you need to add are the PHP_VALUE lines if your access file works the way you want it now.

  16. hi. First of all, i would like to thank u for this piece of code:) it made my life easier
    But i have one problem..I need to create uploader with manual selecting of upload dir from select box. How would u suggest to pass selectBox.value to uploader? i tired loading whole swf part with AJAX (onChange=loadurl(…)), but it doesn’t load at all. I’m confused:)
    thanks

  17. Hi s4cr. I’m sorry, I’m not exactly sure what you’re asking. Can you explain it better and, perhaps, provide a link to illustrate?

  18. thanks:)

    i have one more question. After uploading a file, index.php loads. How can i change that? i would like to load the page with info, download links ect of the uploaded file.

Comments are closed.