I'm new on mac and xampp...
i try to uploads file with this script:
1)form to choose file:
- Code: Select all
<form enctype="multipart/form-data" action="up10b.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
2) php script to upload file:
- Code: Select all
<?php
$uploaddir = 'htdocs';
$uploadfile = $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
?>
It didn't work, so i set htdocs permission in this way:
sistema Read & write
admin Read & write
everyone Read & write
first question:
Is it ok? Is it insecure? I have to create a website for an exam at the university, just local, i don't have to put in online....
second question:
Files that i uploads go on my htdocs directory. But i would them go on a sub-directory htdocs/uploads. I try to change script:
$uploaddir = 'htdocs'; >> ON >> $uploaddir = 'htdocs/uploads';
but it doesn't work.... maybe i can't create a folder in htdocs? how can i do?
CAN ANYONE SPEND 5 MINUTES WITH ME??
please, i need help....