Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: vsstephen on July 19, 2007, 11:05:04 AM

Title: SME Linux Apache php move_uploaded_file, file upload problem
Post by: vsstephen on July 19, 2007, 11:05:04 AM
In Windows following code works fine, but in linux i can not able to upload the file in to a specified directory, can you help me how to over come this problem. below is a code and output result of the code, please help

<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = '/var/www/uploads/';
$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>";

?>

Error:
Possible file upload attack!
Here is some more debugging info:Array
(
    [userfile] => Array
        (
            [name] => 01256dddddsssdddSales.zip
            [type] => application/x-zip-compressed
            [tmp_name] => /tmp/phpijuVut
            [error] => 0
            [size] => 327
        )

)