1,105,406 Community Members

parse errors: syntax error - HELP

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi everyone, I'm totally new to PHP and I am trying to create a script that allows users to upload a picture which will then be emailed to me along with their details. When debugging, I keep receiving the message Parse error: syntax error, unexpected $end in C:\Users\Admin\Web\php-form-action.php on line 85.

Any help would be greatly appreciated.
Thanks in advance!

<?php 

//Settings 
$max_allowed_file_size = 5000; // size in KB 
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = './uploads/'; 
$your_email = 'myemailaddress';//
$errors ='';

if(isset($_POST['submit']))
{
	//Get the uploaded file information
	$name_of_uploaded_file =  basename($_FILES['uploaded_file']['name']);
	
	//get the file extension of the file
	$type_of_uploaded_file = substr($name_of_uploaded_file, 
							strrpos($name_of_uploaded_file, '.') + 1);
	
	$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;
	
	///------------Do Validations-------------
	if(empty($_POST['name'])||empty($_POST['email']))
	{
		$errors .= "\n Name and Email are required fields. ";	
	}
	if(IsInjected($visitor_email))
	{
		$errors .= "\n Bad email value!";
	}
	
	if($size_of_uploaded_file > $max_allowed_file_size ) 
	{
		$errors .= "\n Size of file should be less than $max_allowed_file_size";
	}
	
	//------ Validate the file extension -----
	$allowed_ext = false;
	for($i=0; $i<sizeof($allowed_extensions); $i++) 
	{ 
		if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
		{
			$allowed_ext = true;		
		}
	}
	
	if(!$allowed_ext)
	{
		$errors .= "\n The uploaded file is not supported file type. ".
		" Only the following file types are supported: ".implode(',',$allowed_extensions);
	}
	
	//send the email 
	if(empty($errors))
	{
		//copy the temp. uploaded file to uploads folder
		$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
		$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
		
		if(is_uploaded_file($tmp_path))
		{
		    if(!copy($tmp_path,$path_of_uploaded_file))
		    {
		    	$errors .= '\n error while copying the uploaded file';
		    }
		}
$to = 'myemailaddress' ;
$subject = 'Subject' ;

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$headers = 'From: ' . $_POST [ "from" ] . PHP_EOL ;

$totalmessage = "
		Name:		$name  \n
		Email:		$email  \n
		Message:	$message \n
		Uploaded File:  $_FILES\n";

mail ( $to , $subject , $totalmessage , $headers );
header('location: thankyou.htm');

?>
Member Avatar
pritaeas
mod_pritaeas
11,315 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
0
 

The opening bracket on line 54 is missing a closing bracket somewhere.

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for your reply, much appreciated. Tried adding another closing bracket after the closing bracket on 65, but I'm still receiving the error, albeit on line 86 rather than 85. Am I placing the closing bracket in the right place? Any ideas?

Member Avatar
ddymacek
Posting Whiz
324 posts since Jun 2010
Reputation Points: 15 [?]
Q&As Helped to Solve: 68 [?]
Skill Endorsements: 0 [?]
 
2
 

the opening bracket from line 10, is also missing a closing bracket. along with the one from line 54 as pritaeas pointed out. so you need to add in the closing bracket for both of those statements.

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for pointing out the missing brackets. I've ammended the code:

<?php 

//Settings 
$max_allowed_file_size = 5000; // size in KB 
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = './uploads/'; //<-- this folder must be writeable by the script
$your_email = 'myemailaddress';//

$errors ='';

if(isset($_POST['submit']))
{
	//Get the uploaded file information
	$name_of_uploaded_file =  basename($_FILES['uploaded_file']['name']);
	
	//get the file extension of the file
	$type_of_uploaded_file = substr($name_of_uploaded_file, 
							strrpos($name_of_uploaded_file, '.') + 1);
	
	$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;
	
	///------------Do Validations-------------
	if(empty($_POST['name'])||empty($_POST['email']))
	{
		$errors .= "\n Name and Email are required fields. ";	
	}
	if(IsInjected($visitor_email))
	{
		$errors .= "\n Bad email value!";
	}
	
	if($size_of_uploaded_file > $max_allowed_file_size ) 
	{
		$errors .= "\n Size of file should be less than $max_allowed_file_size";
	}
	
	//------ Validate the file extension -----
	$allowed_ext = false;
	for($i=0; $i<sizeof($allowed_extensions); $i++) 
	{ 
		if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
		{
			$allowed_ext = true;		
		}
	}
	
	if(!$allowed_ext)
	{
		$errors .= "\n The uploaded file is not supported file type. ".
		" Only the following file types are supported: ".implode(',',$allowed_extensions);
	}
	
	//send the email 
	if(empty($errors))
	{
		//copy the temp. uploaded file to uploads folder
		$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
		$tmp_path = $_FILES["uploaded_file"]["tmp_name"];       
    
		
		if(is_uploaded_file($tmp_path))
		{
		    if(!copy($tmp_path,$path_of_uploaded_file))
		    {
		    	$errors .= '\n error while copying the uploaded file';
		    }
		}
    }
}
$to = 'myemailaddress' ;
$subject = 'Subject' ;

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$headers = 'From: ' . $_POST [ "from" ] . PHP_EOL ;

$totalmessage = "
		Name:		$name  \n
		Email:		$email  \n
		Message:	$message \n
		Uploaded File:  $_FILES\n";

mail ( $to , $subject , $totalmessage , $headers );
header('location: thankyou.htm');

?>

I'm no longer receiving an error, and I am receiving an email with the user text input, but instead of the uploaded file it just says "Array".

Any ideas on why the uploaded file isn't being attached?

Thanks!

Member Avatar
NettSite
Junior Poster in Training
63 posts since Feb 2010
Reputation Points: 19 [?]
Q&As Helped to Solve: 13 [?]
Skill Endorsements: 0 [?]
 
1
 

That's because $_FILES is an array. To see the content of an array in your email, you would need to do something like:

$uploadedFileDetails = var_export($_FILES,true);
$totalmessage = "
		Name:		$name  \n
		Email:		$email  \n
		Message:	$message \n
		Uploaded File:  $uploadedFileDetails\n";

To get the actual uploaded file into the email, you would have to attach it to the email as an attachment, or encode it to be included in the email's body, or save it somewhere on your web server and include a link to it in the email.

Have a look at move_uploaded_file() in the manual. You may also find SwiftMailer helpful : http://swiftmailer.org/

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

EDIT- Sorry Nettsite, I didn't notice the last part of your message. I'll have a read up on that. Thanks!
________________________________________________________________________________________________________________-

Ammended the last part to look like:

$headers = 'From: ' . $_POST [ "from" ] . PHP_EOL ;
$uploadedFileDetails = var_export($_FILES,true);

$totalmessage = "
		Name:		$name  \n
		Email:		$email  \n
		Message:	$message \n
		Uploaded File:  $uploadedFileDetails\n";

mail ( $to , $subject , $totalmessage , $headers );
header('location: thankyou.htm');

?>

And I now receive:

Uploaded File: array('uploaded_file'=>
array(
'name'=>'testimage.jpg',
'type'=>'image/jpeg',
'tmp_name'=>'D:\\Temp\\phpE511.tmp',
'error'=>0,
'size'=>136259,
),
)

This whole thing baffles me- am I passing the image wrong, or?
Thanks for your help!

Member Avatar
ddymacek
Posting Whiz
324 posts since Jun 2010
Reputation Points: 15 [?]
Q&As Helped to Solve: 68 [?]
Skill Endorsements: 0 [?]
 
1
 

'This whole thing baffles me- am I passing the image wrong, or?',
no, as nettsite said, $_FILES is an array of data not the actual file itself.
at this point (sending the email) in your code the actual location of your file is being stored in this variable: $path_of_uploaded_file; which should look something like /uploads/name_of_file.jpg
it isn't exactly easy but also is not hard, but you need to 'read' the file and attach it to your email, another class to look at is PHPMailer
http://code.google.com/a/apache-extras.org/p/phpmailer/downloads/detail?name=PHPMailer_5.2.0.zip&can=2&q=
(not used by me, but found when trying to come up with an answer to your question)
and lastly, here is an example of what you would need to do if you do not use a fore-mentioned class and want to do it yourself.
/* Example Code retrieved from the web -- untested, for a word doc not an image */
$mail_boundary = md5(uniqid(time()));
$mail_headers = "MIME-Version: 1.0\r\n";
$mail_headers .= "Content-type: multipart/mixed;boundary=\"$mail_boundary \"";
$mail_headers .= "\r\n\r\n";
$mail_headers .= "This is a multi-part message in MIME format.";

$mail_headers .= "\r\n\r\n";
$userfile = "./myfile.doc";//***** this is where u use $path_of_uploaded_file
$fp = fopen($userfile, "r"); // open the file
$file = fread($fp, filesize($userfile)); // read the file

$file = chunk_split(base64_encode($file)); // splits file so it fits in mail

$mail_body = "--$mail_boundary\n";
$mail_body .= "Content-type: text/plain; charset=euc-kr\r\n"; // this may mess u up
$mail_body .= "Content-transfer-encoding: 8bit\r\n\r\n"; // not sure about this
$mail_body .= " Here goes the project file.\r\n";
$mail_body .= "--$mail_boundary\r\n";
$filename = basename($userfile);

$mail_body .= "Content-type: application/msword; name=$filename\r\n";
// check your content type, if it is an image u need to use a different content type!
$mail_body .= "Content-transfer-encoding:base64\r\n\r\n";
$mail_body .= $file. "\r\n\r\n";

$mail_body .= " --$mail_boundary--";

mail($mail_to, $mail_subject, $mail_body, $mail_headers);

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks ddymacek, much appreciated. I've tried to implement what you've said so I now have:

<?php 

//Settings 
$max_allowed_file_size = 5000; // size in KB 
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = '/uploads/'; //<-- this folder must be writeable by the script
$your_email = 'my email address';//<<--  update this to your email address

$errors ='';

if(isset($_POST['submit']))
{
    //Get the uploaded file information
    $name_of_uploaded_file =  basename($_FILES['uploaded_file']['name']);
    
    //get the file extension of the file
    $type_of_uploaded_file = substr($name_of_uploaded_file, 
                            strrpos($name_of_uploaded_file, '.') + 1);
    
    $size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;
    
    ///------------Do Validations-------------
    if(empty($_POST['name'])||empty($_POST['email']))
    {
        $errors .= "\n Name and Email are required fields. ";    
    }
    if(IsInjected($visitor_email))
    {
        $errors .= "\n Bad email value!";
    }
    
    if($size_of_uploaded_file > $max_allowed_file_size ) 
    {
        $errors .= "\n Size of file should be less than $max_allowed_file_size";
    }
    
    //------ Validate the file extension -----
    $allowed_ext = false;
    for($i=0; $i<sizeof($allowed_extensions); $i++) 
    { 
        if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
        {
            $allowed_ext = true;        
        }
    }
    
    if(!$allowed_ext)
    {
        $errors .= "\n The uploaded file is not supported file type. ".
        " Only the following file types are supported: ".implode(',',$allowed_extensions);
    }
    
    //send the email 
    if(empty($errors))
    {
        //copy the temp. uploaded file to uploads folder
        $path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
        $tmp_path = $_FILES["uploaded_file"]["tmp_name"];       
    
        
        if(is_uploaded_file($tmp_path))
        {
            if(!copy($tmp_path,$path_of_uploaded_file))
            {
                $errors .= '\n error while copying the uploaded file';
            }
        }
    }
}

$to = 'my email address' ;
$subject = 'Photo Upload' ;

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$headers = 'From: ' . $_POST [ "from" ] . PHP_EOL ;
        
        $mail_boundary = md5(uniqid(time()));
$mail_headers = "MIME-Version: 1.0\r\n";
$mail_headers .= "Content-type: multipart/mixed;boundary=\"$mail_boundary \"";
$mail_headers .= "\r\n\r\n";
$mail_headers .= "This is a multi-part message in MIME format.";

$mail_headers .= "\r\n\r\n";
$userfile = "$path_of_uploaded_file";//***** this is where u use $path_of_uploaded_file
$fp = fopen($userfile, "r"); // open the file
$file = fread($fp, filesize($userfile)); // read the file

$file = chunk_split(base64_encode($file)); // splits file so it fits in mail

$mail_body = "--$mail_boundary\n";
$mail_body .= "Content-type: text/plain; charset=euc-kr\r\n"; // this may mess u up
$mail_body .= "Content-transfer-encoding: 8bit\r\n\r\n"; // not sure about this
$mail_body .= " Here goes the project file.\r\n";
$mail_body .= "--$mail_boundary\r\n";
$filename = basename($userfile);

$mail_body .= "Content-type: image/jpeg; name=$name_of_uploaded_file\r\n";
// check your content type, if it is an image u need to use a different content type!
$mail_body .= "Content-transfer-encoding:base64\r\n\r\n";
$mail_body .= $file. "\r\n\r\n";
$mail_body .= " --$mail_boundary--";

$totalmessage = "
        Name:        $name  \n
        Email:        $email  \n
        Message:    $message \n";

mail($to, $subject, $totalmessage, $mail_body, $headers); 
header('location: thankyou.htm');

?>

The script takes a while, then I'm shown the thank you page, but I'm not receiving an email, so I've obviously down something wrong somewhere along the line.

Any suggestions greatly appreciated

Member Avatar
NettSite
Junior Poster in Training
63 posts since Feb 2010
Reputation Points: 19 [?]
Q&As Helped to Solve: 13 [?]
Skill Endorsements: 0 [?]
 
0
 

You are not handling the upload very well. Try (untested, just typed it here):

// Check if there is somewhere to store the uploaded file:
if (!is_dir("uploads")) {
  if (!mkdir("uploads")) {
    exit("Cannot create uploads folder");
  }
}
// Name the file using the folder and it's original name:
$uploaded_file = "uploads/{$_FILES['uploaded_file']['name']}";
// Place the uploaded file in the uploads folder:
if (!move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $uploaded_file) {
  exit("Error uploading file"); // You could improve on this, check the manual.
}

You can now do stuff with "$uploaded_file" like attach or embed it into an email. Plenty of example code on http://swiftmailer.org/docs/introduction.html.

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks everyone for the replies. I decided to start from scratch and simply the whole script, and work up from there. So far I have this:

<?php
  // Where the file is going to be placed 
$target_path = "uploads/";

/* Add the original filename to our target path.  
Result is "/uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploaded_file']['name']); 

if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploaded_file']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
//define the receiver of the email
$to = 'myemailaddress';
//define the subject of the email
$subject = 'File Upload Test';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$usermessage = $_POST['message'];
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = 'From: ' . $_POST [ "from" ] . PHP_EOL ;
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
//read the atachment file contents into a string,
//encode it with MIME base64,
//and split it into smaller chunks
$attachment = chunk_split(base64_encode(file_get_contents($target_path)));
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"

--PHP-alt-<?php echo $random_hash; ?>--

--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: application/zip; name="attachment.zip" 
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--

<?php
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $usermessage, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed"; 
?>

The file is being uploaded to the correct place, and I am receiving a message to tell me that, but I also receive 'Mail Failed' and don't receive an email. I'd read it may be something to do with the header? I have another script that uses the mail function fine, so I know my server allows it.

Anyone have any ideas?
Thanks in advance

Member Avatar
NettSite
Junior Poster in Training
63 posts since Feb 2010
Reputation Points: 19 [?]
Q&As Helped to Solve: 13 [?]
Skill Endorsements: 0 [?]
 
0
 

I am not sure that the output buffering is going to catch the stuff between lines 33 and 44, I have never tried doing anything like that.

I am also not sure, but it looks like you are putting headers in the message as well.

Hate to be repetitive, but you really are re-inventing the wheel on your email code. You could send the mail in a couple of lines with Swiftmailer, or PHPMailer, etc, and avoid the pain.

Member Avatar
NettSite
Junior Poster in Training
63 posts since Feb 2010
Reputation Points: 19 [?]
Q&As Helped to Solve: 13 [?]
Skill Endorsements: 0 [?]
 
0
 

I am not sure that the output buffering is going to catch the stuff between lines 33 and 44, I have never tried doing anything like that.

I am also not sure, but it looks like you are putting headers in the message as well.

Hate to be repetitive, but you really are re-inventing the wheel on your email code. You could send the mail in a couple of lines with Swiftmailer, or PHPMailer, etc, and avoid the pain.

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks everyone. Sorry I've not commented in a while, been busy and thought leaving it for a while and going back might have given me a fresh burst of insight. So, I've decided to try and use PHPMailer as suggested by Nettsite. Here's what I've got

<?php
// Where the file is going to be placed
$target_path = "uploads/";
 
/* Add the original filename to our target path.
Result is "/uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploaded_file']['name']);
 
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}

$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$message = $_POST['message'];

$totalmessage = "
        Name:        $name  \n
        Email:        $email  \n
        Telephone:    $telephone  \n
        Message:    $message \n";

require("phpmailer.inc.php");        
$mail = new phpmailer;

$mail->IsSMTP(); // set mailer to use SMTP
$mail->From = $email;
$mail->FromName = "Upload Test";
$mail->Host = "localhost";  // specify main and backup server
$mail->AddAddress("myemail");
$mail->WordWrap = 50;    // set word wrap
$mail->AddAttachment($_FILES['uploaded_file']['tmp_name'], $_FILES['uploaded_file']['name']);  // add attachments


$mail->IsHTML(true);    // set email format to HTML
$mail->Body = $totalmessage;
$mail->Send(); // send message
?>

The file is being uploaded fine, but when I test it online I receive:

"The file academy text.gif has been uploaded

Mailer Error
Description:
Could not find D:\Temp\php5591.tmp file on filesystem"

From what I can see, it looks like it's not looking in the 'uploads' folder for the file, and it's using the temporary name instead of the files actual name.

Anyone have any ideas?
Thanks once again

Member Avatar
diafol
Where are my eyes?
12,978 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

Is it this line?

$mail->AddAttachment($_FILES['uploaded_file']['tmp_name'], $_FILES['uploaded_file']['name']);  // add attachments

$_FILES

You're on localhost? Can phpmailer work for you? Do you have a mailserver (eg. Mercury) ?

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, thanks for the response. Yes, it's in that line that I think I'm setting the directory wrong. On the server, the files are stored in uploads/

I've not actually got that far, I assumed that an email wasn't being sent since the file wasn't being attached. I saw 'localhost' being used in another example online and thought I'd try it as I don't know what settings to use in other examples for setting the host. Is there an easy solution to that particular issue?

Member Avatar
diafol
Where are my eyes?
12,978 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

If you want to send an email from your local machine, you need to set up a mail server. If you're using xampp, it comes with the build-in Mercury mail server, but you need to start it.

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Ahh okay, i'll look into that. Any idea on why the file can't be found in the upload directory?

Member Avatar
pritaeas
mod_pritaeas
11,315 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
0
 

After move_uploaded_file() the temporary file is gone, use $target_path instead.

Member Avatar
cbwhellmouth
Newbie Poster
17 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, thanks for that. I changed the line to read:

$mail->AddAttachment($target_path);  // add attachments

and I receive:

"Fatal error: Cannot access empty property in E:\kunden\homepages\19\d345303379\www\phpmailer.inc.php on line 271"

I've also noticed that when I receive a message to say the file has been uploaded, I cannot see the file in Filezilla for a couple of minutes.

Can anyone tell me what I should be changing to add the attachment?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: