I've got the following simple form:
<form method='POST' action='upload.php' enctype="multipart/form-data">
<input type="file" name="message">
<button type='submit' value='submit'>Upload Message</button>
</form>
I also have some validation, simplified here:
if(isset($_FILES['message']) || !empty($_FILES['message']['name']) ){
//validation here
}else{
//if no file is set, we repeat the form.
}
This code seems to work validating all kinds of files. BUT the problem comes when I try to upload audio files. When I do that, the if
statement doesn't return true and I end up in the else
section, seeing my form again as if I've done nothing. How do I make the page recognize that an audio file was uploaded?
So far, I've tried removing the if/else
statement altogether, but then my validation just spits out an error saying I've got an undefined index $_FILES['message']
.
I've also made certain to set my php.ini upload_max_filesize and post_max_size, to no avail.