file upload not saving file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zorro

    #1

    file upload not saving file

    Hello,
    When I upload an image to the server I get the message:

    Warning: Only -1 bytes were written, expected to write 547


    The server phpinfo lists :


    file_uploads On
    upload_max_file size 2M
    upload_tmp_dir /tmp
    PHP Version 4.4.1


    so I created a directory named tmp at the root of my "server space" and

    gave it chmod 777, but still the same error occurs. This is the result
    of print_r($_FILES['myfile']) :


    Array ( [name] => 2.jpg [type] => [tmp_name] => [error] => 7 [size] =>
    0 )


    Error 7 in the PHP manual is :


    UPLOAD_ERR_CANT _WRITE
    Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.


    Any ideas what is wrong?

  • tim

    #2
    Re: file upload not saving file


    zorro wrote:[color=blue]
    > Hello,
    > When I upload an image to the server I get the message:
    >
    > Warning: Only -1 bytes were written, expected to write 547
    >
    >
    > The server phpinfo lists :
    >
    >
    > file_uploads On
    > upload_max_file size 2M
    > upload_tmp_dir /tmp[/color]


    Try using the full path name of /tmp.

    I think php is trying to write to the tmp dir in the root directory of
    the hard drive not the tmp dir in your home directory

    TIm

    Comment

    • zorro

      #3
      Re: file upload not saving file

      yup, it was a path thing during move_uploaded_f ile...

      I had this:

      @move_uploaded_ file($_FILES['picture']['tmp_name'],
      $_SERVER["DOCUMENT_R OOT"] . APP_PATH . "pictures/" . $newname);

      then removing $_SERVER["DOCUMENT_R OOT"] . APP_PATH got it working

      Comment

      Working...