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!
attachments have 0 bytes
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: attachments have 0 bytes
Code: Select all
var_dump($_FILES);Re: attachments have 0 bytes
It returns 0
-------
i have this
echo("<p>" . $file_path . " " . $file_name . " " . $file_type . " " . $file_size . "</p>");
returning all the correct information one line before the attachment line:
-------
i have this
echo("<p>" . $file_path . " " . $file_name . " " . $file_type . " " . $file_size . "</p>");
returning all the correct information one line before the attachment line:
Code: Select all
if($file_path && $file_name && $file_type) {
echo("<p>" . $file_path . " " . $file_name . " " . $file_type . " " . $file_size . "</p>");
$sw_message->attach(new Swift_Message_Attachment(file_get_contents($file_path),$file_name,$file_type));
}
echo("<p>" . $file_path . " " . $file_name . " " . $file_type . " " . $file_size . "</p>");
echo ("<p> starting to send mail</p>");
echo ("<p>" . $_FILES['upload']['error'] . "</p>");
// Now we're ready to send the message
$swift->send($sw_message, $to, $from);
echo('<h1>Thank You For your Submission</h1>');
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: attachments have 0 bytes
Code: Select all
var_dump(realpath($file_path));