So I built this simple script to upload files to an XAMPP server, and . . . it didn't work. When I ran it, it dies after the first if
statement. EDIT: FIXED
Here's the FIXED html code:
<!DOCTYPE html>
<html>
<head>
<title>Awesome Life: File Upload</title>
<link rel="stylesheet" href="forms.css">
</head>
<body>
<div id="big_wrap">
<section id="sign_up">
<form action="http://localhost/mail.php" method="post" ENCTYPE="multipart/form-data">
<span id="upText">File to Upload</span>
<br />
<input style="margin-top:5px;" type="file" name="fileName">
<br />
<br />
<input type="submit" id="button" name="submit" value="Upload">
</form>
</section>
</div>
</body>
</html>
And here's the FIXED script:
<?php
if(!isset($_FILES["fileName"])){
die("It didn't work!");
}else{
move_uploaded_file($_FILES["fileName"]["tmp_name"], "\xampp\htdocs\".$_FILES["fileName"] ["name"]) or die("Didn't work");
}
?>
The file type isn't determined or tested, as I'm not going to be using this on the World Wide Web. I'm simply wondering why it doesn't work. Thanks!
EDIT: It was a simple matter of changing the edit permissions of the htdocs folder. I unchecked the read-only box and it worked fine. Thanks to all for contributing, and especially to Fred -ii-