HTML Form/PHP Email Image Upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hellonovember
Forum Newbie
Posts: 2
Joined: Sat Oct 09, 2010 2:55 pm

HTML Form/PHP Email Image Upload

Post 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? :(
hellonovember
Forum Newbie
Posts: 2
Joined: Sat Oct 09, 2010 2:55 pm

Re: HTML Form/PHP Email Image Upload

Post by hellonovember »

Anyone?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: HTML Form/PHP Email Image Upload

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply