View Single Post
  #8 (permalink)  
Old 26-01-2007, 11:21
intervizual intervizual is offline
Junior Member
 
Join Date: Jan 2007
Posts: 6
Default

Been having the same sort of issues. Been trying to sort it out via email, but its taking quite a while, so thought I would post here.

Been trying to sort out an uploader that works fine on my local environment, and with my old web hosts, but cant get it to work on my new webspace with eukhost.

Tried a number of other scripts, all giving the same issues.

uploaded a basic script to test.intervizual.net/uploadtest.php which contained the following:
Code:
form enctype="multipart/form-data" action="uploadtest1.php" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
"

This then calls uploadtest1.php when submit pressed

<?php

$uploaddir = '/attachments/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
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";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?> 

However I get the following error message when I try to use the script. There is a folder called attachments on the server off the root, so this should be working as far as I can see - is this likely to be a config issue on the server?

Warning:  move_uploaded_file(/attachments/beer-waterfall.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/interviz/public_html/test/uploadtest1.php on line 17



Warning:  move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpl0molY' to '/attachments/beer-waterfall.jpg' in /home/interviz/public_html/test/uploadtest1.php on line 17

Possible file upload attack!
Here is some more debugging info:Array
(
    [userfile] => Array
        (
            [name] => beer-waterfall.jpg
            [type] => image/jpeg
            [tmp_name] => /tmp/phpl0molY
            [error] => 0
            [size] => 30644

Last edited by intervizual; 26-01-2007 at 11:25.
Reply With Quote