whoknows361
Technical User
OK, I have been working on this - with some help - so thanks very much.. Here's the deal:
I am using a form in flash which a user clicks a button and a file is chosen and uploaded using the following php file "upload.php" - (notice the session variable)
what this does is upload the file to the "files" directory - now this works perfectly... next in the flash file the user fills out a form and clicks the send email button - which calls the following php page "sendmail.php" - again
notice how I used the session variable:
Now - I am sure the flash code is correct. the image file uploads correctly & the email is sent and has all the right fields displayed - except that it does not contain the attachment. So it is clear that the session variable is not passing from the first php file to the second php file. Am I doing this correctly? If not, what are my options. Thanks in advance.
Jonathan
I am using a form in flash which a user clicks a button and a file is chosen and uploaded using the following php file "upload.php" - (notice the session variable)
Code:
<?
session_start();
// store session data
$_SESSION['myname']=$_FILES['Filedata']['name'];
//move the uploaded file
$file = "./files/".$_FILES['Filedata']['name'];
move_uploaded_file($_FILES['Filedata']['tmp_name'], $file);
chmod("./files/".$_FILES['Filedata']['name'], 0777);
?>
what this does is upload the file to the "files" directory - now this works perfectly... next in the flash file the user fills out a form and clicks the send email button - which calls the following php page "sendmail.php" - again
notice how I used the session variable:
Code:
<?
require("class.phpmailer.php");
$s_message = $_POST['sender_message'];
$s_mail = $_POST['sender_mail'];
$s_webpage = $_POST['sender_webpage'];
$s_title = $_POST['sender_title'];
$s_image = $_SESSION['myname'];
$mail = new PHPMailer();
$mail->From = $s_mail;
$mail->FromName = $s_mail;
$mail->AddAddress("logoskreations@yahoo.com","Jonathan");
$mail->AddReplyTo("logoskreations@yahoo.com","Jonathan");
$mail->WordWrap = 50; // set word wrap
$mail->AddAttachment($s_image); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "you have received an image from Chongaton.com";
$mail->Body = "users webpage is: $s_webpage. users title is: $s_title. users email is: $s_mail. users message is: $s_message";
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
Now - I am sure the flash code is correct. the image file uploads correctly & the email is sent and has all the right fields displayed - except that it does not contain the attachment. So it is clear that the session variable is not passing from the first php file to the second php file. Am I doing this correctly? If not, what are my options. Thanks in advance.
Jonathan