dimanche 19 avril 2015

html form not uploading file via post to a php script

So I have the following html form





<form name="input" onsubmit="return validateForm()" action="validate-signup.php" method='post' enctype="multipart/form-data">
name: <input type='text' name='name'/><br/>
password: <input type='text' name='password'/><br/>
email: <input type='text' name='email'/><br/>
phone number: <input type='text' name='phone'/><br/>
profile picture: <input type="file" name="file" size="25"/><br/>
<input name="submit" type="submit" value="Submit"/><br/>
</form>



after which I have the following php code



if (isset($_POST['submit'])) {
if ($_FILES['file']['name'] != "") {
copy($_FILES['file']['name'], getcwd()) or
die("Could not copy file!");
} else {
die("No file specified!");
}
}


the problem is $_FILES is empty. I've looked at past answers for this topic checked my php.ini, checked read write permissions etc but I'm still stumped. I'm running this using wamp, and editing my work in netbeans if this makes a difference.


Aucun commentaire:

Enregistrer un commentaire