www.webdeveloper.com
Results 1 to 2 of 2

Thread: Using $_FILES

  1. #1
    Join Date
    Mar 2006
    Posts
    15

    Question Using $_FILES

    I'm trying to allow the user to select a picture and attach it to the form which the sends the email.

    Eveything works execpt the attaching a picture part, and I'm sure it has to do with my $_FILES Command.

    picture is the name used for the input in my form.
    PHP Code:
    <?

    $do 
    = ($_POST['do']);

    if(
    $do == "send")
    {
        
    $recipient "abcd@xxx.com";
        
    $name = ($_POST['name']);
        
    $email = ($_POST['email']);
        
    $phone = ($_POST['phone']);
        
    $upload = ($_FILES['picture']);
        
    $message = ($_POST['message']);
        
    $body "Name: $name \r\n Email: $email \r\n Phone: $phone \r\n Description: $message \r\n $upload";
        
    $formsend mail("$recipient""-QUOTE-","$body""From: $email ($name)\r\nReply-to:$email");

        echo (
    "<p>Your quote was sent!</p>");
    }
    ?>
    Thanks,
    Last edited by hubiejr; 05-09-2006 at 01:37 AM.

  2. #2
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,736
    $_FILES['fieldname'] holds an array of details about a particular file (or files), not the file itself. Also even if it did contain the image file contents as a string you can't just include it inline in your email body.

    Check out the mime mail script on my site or do a search on sending mime mail. Also check out the sticky on uploading images.
    Last edited by bokeh; 05-09-2006 at 04:57 AM.

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



Recent Articles