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

    php file upload to linux server


    I have a Flash movie that allows a user to upload an image to a server, using a php script. Once uploaded, the file is then loaded into the Flash movie from the server so that it is displayed to he user.

    I had all of this working totally fine on a shared-hosting server I had been using... but I recently switched over to a dedicated-virtual server, and as soon as I did it stopped working! The progress bar shows that the file is being uploaded, but then 'hangs' at the end, and does nothing. Logging into the server via ftp, I can see that the file was indeed successfully uploaded, however it won't let me delete it off of the server (it says I don't have permission). Looking at the properties of the file on the server, it shows the user and group as 'apache', where as on the old server it showed the user as my ftp login, and allowed me to delete it.

    I can't figure out why it keeps 'hanging', and why the Flash movie won't load in the file. All of the Flash coding, and PHP settings (i.e. safe_mode, upload_max_filesize, etc.) all match the old I'm stumped.

    The code I'm using in PHP to upload the file is:

    PHP Code:
    //create the directory if doesn't exists (should have write permissons)
    if(!is_dir("pix/$folderName")) mkdir("pix/$folderName"0755); 
    //move the uploaded file
    move_uploaded_file($_FILES['Filedata']['tmp_name'], "pix/$folderName/".$_FILES['Filedata']['name']);
    chmod("pix/$folderName/".$_FILES['Filedata']['name'], 0777);
    Any suggestions/ideas would be greatly appreciated. If you need clarification of anything, please just let me know.


  2. #2
    Just Joined!
    Join Date
    Jan 2008
    Ukraine, Russia

    post size

    You change next thing in php.ini ?:

    ; Maximum size of POST data that PHP will accept.
    post_max_size = 100M

  3. #3
    Quote Originally Posted by View Post
    You change next thing in php.ini ?:

    ; Maximum size of POST data that PHP will accept.
    post_max_size = 100M
    Hi Ras.Su,

    I have it set to be 10M, which is far more than the images being uploaded (the one I've been testing is under 1MB)

    Thanks for the suggestion tho!

  4. $spacer_open
  5. #4
    If you've got an ftp server, why not just do the upload with php's ftp functions? Something like:
    PHP Code:
    ftp_connect('server name or ip');
        if (
    ftp_put($ftp$_FILES['Filedata']['name'], 'path/to/directory/' $_FILES['Filedata']['tmp_name'], FTP_ASCII)) {

Posting Permissions

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