Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Unhappy php file upload to linux server

    Hello all:

    I am having a problem with a Flash AS3 form with PHP file upload on a linux server. I had this form working fine on a Windows Server, But then I moved to a Linux server and it stopped working correctly. As I checked, the form uploads the file correctly but it fails at the very end (at 100% of the progress bar) to inform the file has successfully been uploaded. By the PHP code, after the uploaded file is finally uploaded, it will be moved to a defined folder, but this seems not to happen.

    Could it be a restriction or a limitation on the Linux Server for not allowing to move the file to the specified folder ??

    I chmod the folder and files to 777.

    This is the PHP code:

    PHP Code:

    // Set local PHP vars from the POST vars sent from flash
    $todayDate $_POST['todayDate'];
    $Name $_POST['Name'];
    $Email $_POST['Email'];
    $filename $_FILES['Filedata']['name'];    
    $filetmpname $_FILES['Filedata']['tmp_name'];    
    $fileType $_FILES["Filedata"]["type"];
    $fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 1000);

    // Place file on server, into the images folder
    move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$filename);

    // This section edits your log file, if you don't need a text log file just delete these lines
    $myFile "logFile.txt";
    $fh fopen($myFile'a') or die("can't open file");
    $stringData "\n\ntodayDate: $todayDate  \n Name: $Name \n Email: $Email \n ssid: $ssid \n FileName: $filename \n TmpName: $filetmpname \n Type: $fileType \n Size: $fileSizeMB MegaBytes";
    // End log file edit

    Can anyone help me please ??? Thanks in advance !!!

  2. #2
    do you get any errors in the error log? how is php running(apache module, fastcgi or suphp)? is safe_mode enabled? is open_basedir restriction in effect?

  3. #3
    Check if you have permission on folder.
    Apache server use apache as user in Fedora and www-data in ubuntu/debian

    ll ../images

  4. $spacer_open
  5. #4
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Western Kentucky
    I'd wager its writing in the tmp directory or somewhere like that. You're chrooted, which means you can't get to the file. You need to change upload_tmp_dir to an area that is accessible.
    linux user # 503963

  6. #5


    Well, the problem was solved strangely. First, my hosting provider said I could not change any PHP permissions because the hosting package I have is located in a shared server and this server has universal sever permissions for PHP. I tested My file uploader in another linux sever as the same as I have and WORKED !!! ...

    So what was the difference ???: The PHP file was in the root of my linux server instead of inside another folder. The PHP files that worked were located in "public_html". The PHP file that didnīt work were inside a folder "public_html/folder/".

    When I changed the PHP file to the "public_html" folder and redirect the AS3 Flash to look for it at that location, the File uploader started to work, even when the file uploader was inside the "public_html/folder/" folder.

    I wonder why this happens ??? I have read about many people with the same problem around the web. It would be nice if someone can help us with an explanation.

    Thanks all for your help !!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts