kwandoa Posted April 18, 2013 Share Posted April 18, 2013 I would like to know what changes to the code i need to make in order to uipload pdf files? I would think that the changes are to be made somewhere around here: $allowed = array ('image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png','image/x-png'); if (in_array($_FILES['upload'] ['type'], $allowed)) { Link to comment Share on other sites More sharing options...
margaux Posted April 18, 2013 Share Posted April 18, 2013 If you want to be able to upload pdf files in addition to those other file types, you need only amend the $allowed array to include the value 'application/pdf'. If you want to upload only pdf files you might want to check the file extension in addition to the file type e.g. if ($_FILES['upload']['type'] == 'pdf' && substr($_FILES['upload']['tmp_name'], -4) == '.pdf'){ 1 Link to comment Share on other sites More sharing options...
Recommended Posts