Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    10
    Rep Power
    0
    I'm using this for attachment:

    $mail->AddStringAttachment($content,$file,'base64','application/pdf');

    But It send the pdf with 1 KB..
  2. #17
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    A couple of the stackoverflow posts found in this search have some example php snips for storing pdf's in a blob. It's often difficult to get a rational answer to any question asking about storing images and other binary data in a db, there are far too many who'd rather just say "store in the file system", even though that's not an answer to the question.

    https://www.google.com/search?q=php+save+pdf+in+blob+and+retrieve+it&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-USfficial&client=firefox-a

    Comments on this post

    • Jacques1 disagrees : Maybe you should actually [I]read[/I] the replies before you accuse us of not helping people.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  4. #18
  5. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Originally Posted by Doug G
    It's often difficult to get a rational answer to any question asking about storing images and other binary data in a db, there are far too many who'd rather just say "store in the file system", even though that's not an answer to the question.
    A small update for you, since you appearently stopped at the second post: The data already is in a BLOB, I explained how to move it into an email attachment, and now there seems to be a concrete issue with PHPMailer.

    I you actually wanna help and not just throw around accusations and useless links, then help him with the PHPMailer problem. Thanks.
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  6. #19
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    10
    Rep Power
    0
    Hi everyone,

    I solved my problem...

    I don't know if it was the best choice I made but the solution for my problem was:

    1º) generate pdf and save it into folder.
    2º) Save name of pdf file into database.
    3º) Check if the pdf file is in the folder.
    4ª) Compare name of pdf file in the folder and the name on the Database.
    5ª) attach the pdf file with AddAttachment.
    6º) Sending email

    Works fine and I can sending multiple emails wihtout problems

    Thanks everyone to helping me in this problem.
  8. #20
  9. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Originally Posted by jonito
    I don't know if it was the best choice I made but the solution for my problem was:
    Yep. Simply saving files as files is usually the most hassle-free approach (like we already said).
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  10. #21
  11. Web Developer/Musician
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Nov 2004
    Location
    Tennessee Mountains
    Posts
    2,408
    Rep Power
    1031
    Originally Posted by jonito
    So you tell me there's no way to save content of the pdf?
    I know storing pdf file into file system is the best way but, in my case, I don't need this because is unnecessary. I don't want to overload my site with thousands of pdf files.

    Just that...If there's no way to store content of pdf file like I want then I will use your methods

    Thanks

    Jonito
    You are going to overload your database system long before you overload your filesystem. That isn't what databases are intended for, and if you don't need the PDFs after they have been sent out you can either archive them on another machine through FTP or delete them when no longer needed.
  12. #22
  13. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    We already had that discussion. Several times.
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  14. #23
  15. Web Developer/Musician
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Nov 2004
    Location
    Tennessee Mountains
    Posts
    2,408
    Rep Power
    1031
    Originally Posted by Jacques1
    We already had that discussion. Several times.
    Yes I realize that now.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo