|  | Posted by Johnny on 10/12/06 00:45 
"ljuljacka" <ljuljacka@yahoo.com> wrote in messagenews:egk0gj$iui$1@news1.carnet.hr...
 > I'm just trying to run a fileupload script from the manual, just to see
 how
 > it works, and it won't. I've checked if file upload is enabled and it is.
 > Also, the file I'm trying to upload is smaller then max. The folder I'm
 > trying to upload files to is ./ispit1. I always get the "wrong" echo from
 > the script when I run debug in my editor and when I run it in my browser
 > (firefox) I get the following message:
 >  "The requested URL /ispit/__URL__ was not found on this server."
 > The file isn't transfered to tmp directory either.
 > Any help is welcome.
 >
 > <form enctype="multipart/form-data" action="__URL__" method="POST">
 > <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
 > Send this file: <input name="userfile" type="file" />
 > <input type="submit" value="Send File" />
 > </form>
 >
 >
 > <?php
 > $uploaddir = './ispit1/';
 > $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
 >
 > if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
 >    echo "File is valid, and was successfully uploaded.\n";
 > } else {
 >    echo "Possible file upload attack!\n";
 > }
 > ?>
 >
 >
 Every LAMP server I've worked on doesn't have write file permission to do
 the move. PHP always seems to run as 'other' and to allow wriet permssions
 on 'other' would not seem to be a good thing.  The way I have been able to
 do it is by incorporating PHP FTP functions and moving the file with them.
 
 Here's how I debug by putting this at the top of the file posted to right
 after the opening php tag:
 var_dump($_FILES);
 and see what's happening.
 Most likely its permissions though
  Navigation: [Reply to this message] |