Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Photos Attached to Email

Posted on 2004-08-20
8
Medium Priority
?
264 Views
Last Modified: 2010-04-09
I have been searching for a while now (possibly not hard enough) and can't seem to find what I'm looking for.

I would like to know how to allow users to attach images to an email on my contact page.  This would be so that users could "Submit Photos" to me (the webmaster) so that I can post them on the website.

So, basically I know the HTML portion of it (or the basics of it)

<form name="photoSubmit" action="../scripts/photosubmit.php">
Your Name: <input name="name" type="text" size="30"></input>
Your Email: <input name="email" type="text" size="30"></input>
Photo Title: <input name="ptitle" type="text" size="30"></input>
Photo Description: <textarea name="pdescrip" type="text" rows="20" size="50"></textarea>
Photo Copyright: <input name="copyright" type="text" onClick="value=''" value="This Photo is Copyright 2004 SOMEONE"></input>
<input type="Submit" name="Send" label="Submit the Photos"></input>
<input type="Reset" name="Reset" label="Reset the Form"></input>
</form>

Now, the PHP will be the regular mail script, with the normal stripping of slashes, and sending it to a pre-determined email address.  The only part I don't get is creating the "Attachment:" input selection, and how to add the PHP to it to allow the submission of the image.

Any and all help would be appreciated.

~Brett
0
Comment
Question by:bpat1434
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 19

Expert Comment

by:webwoman
ID: 11857528
You need a special upload component to handle the file. I'm pretty sure there's one for PHP. Your server will also need to be able to handle uploads.
0
 

Author Comment

by:bpat1434
ID: 11857546
Any idea as to what some good ones are, and how/where i can check for the ability to handle uploads?

~Brett
0
 
LVL 10

Accepted Solution

by:
daleoran earned 200 total points
ID: 11860287
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:Boris Aranovich
ID: 11871196
well, there are several steps.
First of all, you have to add a file field to the form
<input type="file" name="attachmentfile" />

then, to the <form> tag, you need to add enctype="multipart/form-data", and also i'd suggest using method="post":
<form name="photoSubmit" action="../scripts/photosubmit.php" method="post" enctype="multipart/form-data">

then, you will have 2 ways.
Either you'll have to save the uploaded file somewhere (http://www.php.net/manual/en/features.file-upload.php) and then just add <img src="someurl" /> to the mail, if you have it as text/html mail,
or the 2nd method, is creating a Multipart MIME e-mail, and attaching the file data in base64_encode() form to the body (http://www.theukwebdesigncompany.com/articles/php-file-attachments.php and http://www.zend.com/zend/spotlight/sendmimeemailpart1.php)

Hope this helps
0
 
LVL 9

Expert Comment

by:DrWarezz
ID: 11874166
I recommend using JSP.

[r.D]
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 12803944
Why would you recommend another server language when php is installed, runs and the person asking seems to know it?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question