Jump to content

Recommended Posts

I have an online form which when filled in and submitted converts into a pdf file and saves on database/server. I want to, as part of the process, attach the saved file on database and send as email.Currently am having ' failed to open stream: No such file or directory' while using phpmailer. I am not sure whether to use $_FILES function since I am not uploading a file. Any ideas or solution will help.

 

 

Thanks in advance.

 


 ' failed to open stream: No such file or directory' 

 

That error comes when the filename or the path to the file is wrong. make sure your path doesn't start with anything relative, like "../foo/bar/file.pdf" because that's the number one cause of this error. Use the complete, full path from the filesystem's root.

That error comes when the filename or the path to the file is wrong. make sure your path doesn't start with anything relative, like "../foo/bar/file.pdf" because that's the number one cause of this error. Use the complete, full path from the filesystem's root.

Thank you very much Vinny42. I tried this approach and got a blank attached document and the error log indicates that the file could not be located. My concern is the method to use to pick up this file. I know this may seem amatuerish but I have tried $file="absolute_path/filename.pdf" also $file=$_FILES['']; although I think the latter may not be correct as I am not uploading from the front end. I am using PHPMailer and the line to read the file is $_FILES["my_file"]["tmp_name"]. A simple approach in geneal to go about this will be really helpful. Upoading a file from database and sending as email attachment. Thanks.

Edited by MqTontoh

$_FILES has nothing to do with it, that is *only* for uploading files using a form.

 

"and the error log indicates that the file could not be located."

 

 

So your file does not exist where you think it should exist. There's nothing I can do to help you debug that except saying that you need to check the location and the filename...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.