HTML Form Upload PDF with other form contents using PHP
- by Sev
I have a HTML form with fields such as name, address, notes, etc. I also have a field to upload a PDF. The uploaded PDF get's stored on the file system.
How can I accomplish this if possibly the PDF files are larger than 2 MBs? Also, for some reason, the uploading of the PDF (< 2 MBs) works fine in Chrome, but not in IE. In IE, the upload doesn't even begin, but in Chrome, it completes fine.
Form header looks like:
method='post' ENCTYPE='multipart/formdata'
edit: the ini setting didn't help
The HTML
<input type='text' name='user' />
<input type='file' name='userfile' />
The basic PHP ( I do some preg matching above, that I haven't included)
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "File uploading failed.\n";
}