PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am trying to write an uplaod script to upload gif's and jpg's... before i limit it to certaint file types and file sizes i need to get the basic upload function working.. this code i am running just says:
Possible file upload attack!
Here is some more debugging info:
<?php
<?
if ($stage==NULL) {
?>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="content/imageup.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="hidden" name="stage" value="1">
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
<?php
} else {
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '../uploads/img';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>' . $uploadfile . '<BR>';
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>";
}
?>
?>
I am new to file uploads not new to php...
The folder it is writeing too is chmod(777) so it should have no problem moveing the file there yet i still get the error message..