[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Photos Attached to Email

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
bpat1434
Asked:
bpat1434
1 Solution
 
webwomanCommented:
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
 
bpat1434Author Commented:
Any idea as to what some good ones are, and how/where i can check for the ability to handle uploads?

~Brett
0
 
daleoranCommented:
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Boris AranovichCommented:
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
 
DrWarezzCommented:
I recommend using JSP.

[r.D]
0
 
Michel PlungjanIT ExpertCommented:
Why would you recommend another server language when php is installed, runs and the person asking seems to know it?
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now