ok, here's the problem i encountered: In my local, this code is working, but in my live server i have an error: here is my html code:
<form enctype="multipart/form-data" action="image_processor.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:<br>
<input name="userfile" type="file" />
<br>
<input type="submit" value="Upload" />
</form>
AND here is my php code:
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = 'images/';
$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>";
?>
when i uploaded to the server, i got this error:
Warning: move_uploaded_file(../www/images/icon.gif): failed to open stream: Permission denied in /home/eowxqroq/public_html/image_processor.php on line 9
Warning: move_uploaded_file(): Unable to move '/tmp/phpZuHexH' to '../www/images/icon.gif' in /home/eowxqroq/public_html/image_processor.php on line 9
Possible file upload attack!
ty in advance