attachments have 0 bytes
Posted: Mon Jun 09, 2008 6:55 pm
I have a mailer setup to upload a file (images, gif, jpg, etc..) to the server and also email the file.
the uploading works
and the attaching "works" in that the file shows up in the mail with the right byte size listed, however if we open the file or download it it has 0 bytes.
this is my attach line:
$sw_message->attach(new Swift_Message_Attachment(file_get_contents($_FILES['upload']['tmp_name']),($_FILES['upload']['name']),($_FILES['upload']['type'])));
the file is uploaded using a html form.
i also have tried storing the $_FILES information to
$file_path = $_FILES['upload']['tmp_name'];
$file_name = $_FILES['upload']['name'];
$file_type = $_FILES['upload']['type'];
and using the $file_bla in the $sw_message line (above)
the other options i have tried:
$sw_message->attach(new Swift_Message_Attachment( new Swift_File($file_path),$file_name,$file_type));
and also using the $_FILEs variables.
it looks like about 200 bytes are uploaded or attached and then it moves on to send the email.
any help is much appreciated.
Thank you!
the uploading works
and the attaching "works" in that the file shows up in the mail with the right byte size listed, however if we open the file or download it it has 0 bytes.
this is my attach line:
$sw_message->attach(new Swift_Message_Attachment(file_get_contents($_FILES['upload']['tmp_name']),($_FILES['upload']['name']),($_FILES['upload']['type'])));
the file is uploaded using a html form.
i also have tried storing the $_FILES information to
$file_path = $_FILES['upload']['tmp_name'];
$file_name = $_FILES['upload']['name'];
$file_type = $_FILES['upload']['type'];
and using the $file_bla in the $sw_message line (above)
the other options i have tried:
$sw_message->attach(new Swift_Message_Attachment( new Swift_File($file_path),$file_name,$file_type));
and also using the $_FILEs variables.
it looks like about 200 bytes are uploaded or attached and then it moves on to send the email.
any help is much appreciated.
Thank you!