Page 1 of 1

HTML Form/PHP Email Image Upload

Posted: Sat Oct 09, 2010 3:04 pm
by hellonovember
Hello! I need help.

I have a very simple HTML form upload where the user can submit a file. This is for a very basic project and I do not need excess code (filetype verification, size restrictions, etc.. none of that please) - I just need help taking the image submitted in the form and attaching it to a PHP mail script. This image will be embedded in some Flickr API and then used to upload images to a Flickr acct via email. So again, nothing fancy. I don't need help with the Flickr API, just the php code extracting the file from the HTML form and putting it into my php script. this is what I have so far.

You can see the form and the code below it here: http://socialsoftware.purchase.edu/alys ... tsform.php

then this is all I have for the PHP end of it:

Code: Select all

<?php

$category = $_GET['tags'];
$attachment = $_GET['name']

$to      = 'who28heard@photos.flickr.com';
$subject = 'tags:'.$category;
$message = $attachment;

$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


?>
I'm assuming $attachment = $_GET['name'] is wrong.


I've been looking all over for help with this, but everything I could find was confusing and way advanced. I am a newb. Help? :(

Re: HTML Form/PHP Email Image Upload

Posted: Sat Oct 09, 2010 3:21 pm
by hellonovember
Anyone?

Re: HTML Form/PHP Email Image Upload

Posted: Sat Oct 09, 2010 8:28 pm
by s.dot
The uploaded file will be in $_FILES superglobal

But actually sending the image via email will be pretty difficult. I suggest looking at swift mailer to send attachments and emails easily.