I have the following script for part of a form which allows a file upload, full script is here: Issue with image upload php: undefined index. It works ok in that it stops the script if there is no file selected and uploads when the form is fully populated (for logged in users only)
What I am trying to do with no luck so far, however is confine the upload type to pdf and jpeg only.
Any suggestions welcome
<?php
if (is_uploaded_file ($_FILES ['image']['tmp_name'])) {
if (move_uploaded_file($_FILES ['image']['tmp_name'],
"uploads/{$_FILES['image']['name']}")) { // Move the file over.
echo '<p>The file has been uploaded!</p>';
} else { // Couldn't move the file over.
echo '<p><font color="red"> The thumbnail image could not be uploaded.</font></p>';
$i = FALSE;
}
$i = $_FILES['image']['name'];
} else {
$i = FALSE;
}
?>