I have a form that allows users to attach files. If you click on browse and choose an image then the form works - it attaches the images to the email. If you leave the fields blank it will give an error. However, if you type anything in the text box nothing happens when Submit is pushed. I am using IE with SP2. This doesn't happen with FireFox.
Here is the code:
<html>
<body>
<table width="639" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="639" height="436" valign="top"><p>attach files</p>
<form name="form1" method="POST" action="process_form.php" enctype="multipart/form-data">
<p>file 1:
<input type="FILE" name="file1">
</p>
<p>file 2:
<input type="FILE" name="file2">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
<input type="hidden" name="form_sent" value="1">
</form> <p> </p></td>
</tr>
</table>
</body>
</html>
process_form.php:
$fp1=fopen($file1, "rb");
$fp2=fopen($file2, "rb");
if (($fp1===false)||($fp2===false)){
echo"files were not attached";
exit();
}
else{
echo"files were attached";
}
I have been looking for a solution for this for a while...any help would be appreciated. Thanks.