Here's some snippets of the code:
This first part checks to see if they're uploading a valid file (it's failing on the first check for all the files I mentioned.
if ($_FILES['file']['tmp_name']=='') { add_error('Enter the image you wish to upload.'); }
else {
preg_match('/^(.*)\.([^\.]+)$/',create_pathname($_FILES['file']['name']),$m_list);
$file_root = $m_list[1];
$file_ext = $m_list[2];
if (($file_ext!='gif') && ($file_ext!='jpg') && ($file_ext!='png') && ($file_ext!='swf') && ($file_ext!='pdf') && ($file_ext!='jpeg') && ($file_ext!='mov') && ($file_ext!='mpeg') && ($file_ext!='mpg') && ($file_ext!='avi') && ($file_ext!='wmv')) { add_error('You have selected an invalid file (gif,jpg,png,swf,pdf,mov,mpg,avi,wmv).'); }
}
A little further down I save the file but this causes an error because tmp_name doesn't have a value if I remove the first check above:
copy ($_FILES['file']['tmp_name'],$dest_dir.$file_root.'.'.$file_ext);
Here's the HTML:
<form action="index.php" method="post" name="list" enctype="multipart/form-data">
<input type="hidden" name="imgID" value="1">
... other hidden variables ....
<p><table border="0" cellpadding="0" cellspacing="5">
.... other inputs ....
<tr><td>Image: </td><td colspan="2"><input type="file" name="image_file" value=""></td></tr>
</table></p>
<p><a href="javascript:document.list.submit();">Add/Update</a>
</p>
</form>
As I mentioned before, this is working fine for gif and jpg and pdf but not for the other file formats. Any ideas? Thanks