Hi,
I’m trying to send an email from a form with an attachment but now I’m stuck because I’m getting this error:
PHP Warning: filesize() [function.filesize]: stat failed for C:WINNTTEMPphpF53.tmp in D:wwweduKeiser Writessubmittal.php on line 54 PHP Warning: fread() [function.fread]: Length parameter must be greater than 0 in D:wwweduKeiser Writessubmittal.php on line 54
[code=php]This is my code:
// Obtain file upload vars
$fileatt = $_FILES[‘upfile’][‘tmp_name’];
$fileatt_type = $_FILES[‘upfile’][‘type’];
$fileatt_name = $_FILES[‘upfile’][‘name’];
$headers = “From: $email”;
if (is_uploaded_file($fileatt)) {
// Read the file to be attached (‘rb’ = read binary)
$file = fopen($fileatt,’rb’);
//$data = file_get_contents($fileatt);
$data = fread($file, filesize($fileatt));
fclose($file);
Can someone help me with this matter? I don’t know where to start with this. This code does work. I have a resellers hosting account I tested it on they are on the Lunix platform but at work I’m on the Windows platform and this does not work.