Results 1 to 2 of 2

Thread: attachment through a web form

  1. #1
    Join Date
    May 2004
    Posts
    75

    attachment through a web form

    I have read several tutorials on mime in php

    i can set up a php form mail very easily... and send information to e-mail and database.

    however i still can't figure out how to attach a picture or a file through a web form to send to a e-mail.

    has anyone created tutorials on this?? i found a few but were not clear


    can anyone help me with this???

    can you post your code on how to add a simple attachment and send it to an email?


    thanks

  2. #2
    Join Date
    Mar 2004
    Location
    China
    Posts
    3,315
    You would do it in two parts. First upload the file to the server, check it's safe and virus free etc. Next build your email and inlude the attached file in one of the email headers e.g. To do a MS word file you might have something like:

    $message .= "Content-Type: application/msword; name=\"my attachment\"\n";
    $message .= "Content-Transfer-Encoding: base64\n";
    $message .= "Content-Disposition: attachment; filename=\"$attachement\"\n\n";

    Where $attachement is the variable containing the file you uploaded in the first part.

    More info can be found by RTFM at php.net. Look under mail and mail().
    http://cn.php.net/manual/en/ref.mail.php
    http://cn.php.net/manual/en/function.mail.php

Similar Threads

  1. Web form problems - help!
    By clidsy in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 06 Feb 2006, 08:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •