Solved

Photos Attached to Email

Posted on 2004-08-20
8
254 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
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 50 total points
ID: 11860287
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now