Does anyone know what the mime type would be of a form that was submitted with a blank field? I am allowing users to upload files to my server using <input type="file/>.
There are some other input fields which users also fill out. I want to allow them to submit even if the "upload" form is blank, but I am limiting uploads to word or text files.
Mime type of blank form submission
Moderator: General Moderators
-
croniccoder
- Forum Commoner
- Posts: 27
- Joined: Fri Jul 07, 2006 10:45 am
-
croniccoder
- Forum Commoner
- Posts: 27
- Joined: Fri Jul 07, 2006 10:45 am
I did. I am using an echo to try and print the mime type:
But it is blank. I don't know if that means it's NULL or an empty string or what?
Code: Select all
$fileatt_type = $_FILES['uploadedFile']['type'];
echo $fileatt_type;- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
var_dump() or var_export() may be of interest then.
-
croniccoder
- Forum Commoner
- Posts: 27
- Joined: Fri Jul 07, 2006 10:45 am
-
croniccoder
- Forum Commoner
- Posts: 27
- Joined: Fri Jul 07, 2006 10:45 am
I want to allow a person to upload a file. The file must be either a word document, or a plain text file. But I also want to allow the form processing to proceed even if the upload form is blank.
But I can't figure out what the correct parameter for $fileatt_name or $fileatt_type would be if the form was blank for the upload?
Code: Select all
$fileatt_type = $_FILES['uploadedFile']['type'];
$fileatt_name = $_FILES['uploadedFile']['name'];
if (!$fileatt_type == "application/msword" || !$fileatt_type == "text/plain" || $fileatt_name == " ")
{