Results 1 to 6 of 6

Thread: I am trying to make a form

  1. #1
    Join Date
    Aug 2005

    I am trying to make a form

    that will allow people to upload a pic to my email addy thru the website? if it is poss i have been trying to do this for a week by rewriting reg form codes to no avail. i will be getting my server space back soon aso that may be what i need not sure.
    if anyone can help a fellow webmaster out i would say thanks many times.

    thank you in advance FireBall

  2. #2
    Join Date
    Jul 2005
    Is this what you are looking for?
    <input type="file" />
    Good Luck,

  3. #3
    Join Date
    Aug 2005
    i have that part of the code and the rest of the form coding but when i do send the email from the site the image doesnt go with the mail only a email full of encryption or nonsense your choice of words for it lol. i am tinkering with a database program now to set on my personal tower and a link to upload the images directly to it instead of email.

  4. #4
    Join Date
    Jan 2005
    Lithia Springs, GA USA

  5. #5
    Join Date
    Aug 2005
    ok i used the send mail php code and it runs perfect for the regular emails but will not send the file thru to my email regardless if i am on IE or FireFox. any ideas i will post the php code in a box for ya to look at and see if i am missing something important.

  6. #6
    Join Date
    Aug 2005
    sorry for the lengthy reply but i dont see where i messed up at
    thank you in advance.

    <title> Sending Email </title>
    // Read POST request params into global vars
    $to = $_POST['to'];
    $from = $_POST['from'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];

    // Obtain file upload vars
    $fileatt = $_FILES['fileatt']['tmp_name'];
    $fileatt_type = $_FILES['fileatt']['type'];
    $fileatt_name = $_FILES['fileatt']['name'];

    $headers = "From: $from";

    if (is_uploaded_file($fileatt)) {
    // Read the file to be attached ('rb' = read binary)
    $file = fopen($fileatt,'rb');
    $data = fread($file,filesize($fileatt));

    // Generate a boundary string
    $semi_rand = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

    // Add the headers for a file attachment
    $headers .= "\nMIME-Version: 1.0\n" .
    "Content-Type: multipart/mixed;\n" .
    " boundary=\"{$mime_boundary}\"";

    // Add a multipart boundary above the plain message
    $message = "This is a multi-part message in MIME format.\n\n" .
    "--{$mime_boundary}\n" .
    "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
    "Content-Transfer-Encoding: 7bit\n\n" .
    $message . "\n\n";

    // Base64 encode the file data
    $data = chunk_split(base64_encode($data));

    // Add file attachment to the message
    $message .= "--{$mime_boundary}\n" .
    "Content-Type: {$fileatt_type};\n" .
    " name=\"{$fileatt_name}\"\n" .
    //"Content-Disposition: attachment;\n" .
    //" filename=\"{$fileatt_name}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $data . "\n\n" .

    // Send the message
    $ok =dbinagia@austin.rr.com($to, $subject, $message, $headers);
    if ($ok) {
    echo "<p>Mail sent! Yay PHP!</p>";
    } else {
    echo "<p>Mail could not be sent. Sorry!</p>";

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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