hi, so the code below works on my pc. but, the code below does not work on my mac. i am a new mac user and the whole mac dir set-up confuses the hell out of me. can someone tell me the correct syntax for the directory on the '$uploaddir =' line. i think that is where the error is because it works just fine on my pc and, as far as i can tell, that is the only line of code that would pose any kind of problem for the mac.
so, i guess what i am asking is: where does the function move_uploaded_file look to put the uploaded file? does it look in the folder where the php files are located on the hard drive? and if so (assuming that uploads is a folder in that place where all the php files are located), is ./uploads in the correct syntax to move the file there?
anyhow, the code below makes the form submit to itself. i got it from another php site. any help any one can provide would be much appreciated. thanks!
<?php
if ( isset($POST['submit']) || count($FILES) ) {
$uploaddir ='./uploads/';
$uploadfile = $uploaddir . basename($FILES['userfile']['name']);
echo $uploadfile;
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>";
}
}
?>
<form enctype ='multipart/form-data' method='post' action='<?php echo $_SERVER['PHP_SELF']; ?>' >
<input type='hidden' name='MAX_FILE_SIZE' value='300000000'>
Send this file: <input name='userfile' type=file>
<input type='submit' name='submit' value='Send File'>
</form>