Welcome, Guest
  • Author Topic: AS2 file upload - onComplete fired without any file in the upload dir  (Read 1808 times)

    secoe

    • Server what's that
    • *
    • Posts: 2
      • View Profile
    my listener.onComplete = function(selectedFile:FileReference) is fired without any file in the upload dir. if the file is small and I wait a bit I can see the file (through FTP) coming up on the server, but most of the times the "onComplete" if fired without any file being saved.

    can I add something to this php code to make sure the file is uploaded? thank you

    Code: [Select]
    $folderloc = $_GET['l'];; 

    if(!is_dir("./$folderloc")) mkdir("./$folderloc", 0755); 

    if(move_uploaded_file($_FILES['Filedata']['tmp_name'], "./$folderloc/".$_FILES['Filedata']['name'])){ 
       chmod("./$folderlocs/".$_FILES['Filedata']['name'], 0777); 

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    reason could be the configuration of max file size at your server.

    The file is unsualy uploaded into a temporary area outside of the webspace.
    The it is inspected and checked against conditions, like file type and file size.
    If they dont match the server settings, the file is deleted, else it is moved to the target folder.
    You can find those settings inside of you php.ini
    happy flashing
    8)
    Ronald

    secoe

    • Server what's that
    • *
    • Posts: 2
      • View Profile
    Thank you for your answer. I checked with several file sizes. Some files of the same, superior or inferior size worked and others didn't, I kept pressing refresh on the FTP client amazed why 2KB files didn't get there and 1MB ones did.

    But your tip sent me on the right track.  I think the "onComplete" is sent for that temp file you wrote about, so he wasn't waiting for the "move" bit. I checked the upload dir and it was missing the write permission (duh).

    I never thought about that because some files got uploaded. But it turned out it was only working for files with the same name, they were already there with write permission and the script overwrote them. It couldn't create new ones but sent that "onComplete" anyway.

    Well, it's solved!!! Thanks again for the help.