I've tried heaps of different things to get my php file upload to work, even trimming it right back to the absolute basics. I've tried different scripts and this and that but it's still giving me errors.
So I have this php script:
if (isset($_POST['submit'])) {
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name'])." has been uploaded";
} else {
echo "There was an error uploading the file, please try again!";
}
}
So as you can see, absolute bare minimum. This is my simple HTML form:
<form action="" enctype="multipart/form-data" name="uploadform" method="post" >
<input size="10" style="border:0px;" name="uploadedfile" type="file">
<input type="submit" name="submit" class="buttonUpload" value="Upload">
</form>
Any file I try and upload gives me the error. This isn't the first piece of code I've tried. I tried the code example of w3schools, that again gave me the file upload error.
I've checked my php.ini and allow file uploads is on.
It's on my local machine so no need to chmod the upload folder.
Any suggestions on why this may be happening ?
Cheers!