Upload image in an html form to be emailed

Hi everyone. Here is another one of my last minute, hurry up and wait requests.
I have to create a form that will enable the viewer to upload an image and send the
form on its way to a predetermined email address. This is for a contest starting tomorrow.
The form has been made and works. The only thing I haven't worked out yet is the "upload image"
feature. This is absolutely necessary and must be included. I have tested this several times and all the data
comes thru. What I need is for an image to go along with the form fields and appear when the email is opened.
With all due respect I do not have a very long learning curve here so if anyone can just provide
me with the code, both html and php, instruct me exactly where to place it I would be
extremely appreciative.
here is the temporary link:
Sirui/Argraph Wildlife-Landscape Photo Contest
The image upload button will be in between the two horizontal rules towards the bottom of the form;
above the submit/reset buttons.
Thanks in advance as always.
-Cliff-

Below is the code and php for your complete form together with the file upload field and code. How you style the form and validate the form fields (if your going to) is down to you. Change the email address marked in red to that of the recipient you want the information to go to.
You need to copy all the code and save it with a php extension so instead of:
SiruiWildlifePhotoContestEntryForm.html
This:
SiruiWildlifePhotoContestEntryForm.php
Obvioulsy being php it only works if the file is on a php enabled server so if you dont have a local testing server you need to upload it to your remote server before it will work.
<?php
if(isset($_POST['Submit']))
//The form has been submitted, prep a nice thank you message
$output = '<h1>Thanks for your file and message!</h1>';
//Set the form flag to no display (cheap way!)
$flags = 'style="display:none;"';
//Deal with the email
$to = 'yourEmailAddress.com';
$subject = 'Competition Entry';
$LastName = ($_POST['LastName']);
$FirstName = ($_POST['FirstName']);
$Email = ($_POST['Email']);
$Phone = ($_POST['Phone']);
$Address1 = ($_POST['Address1']);
$Address2 = ($_POST['Address2']);
$City = ($_POST['City']);
$State = ($_POST['State']);
$Zip = ($_POST['Zip']);
$Dealer = ($_POST['Dealer']);
$TripodMonopodHead = ($_POST['TripodMonopodHead']);
$CameraLens = ($_POST['CameraLens']);
$ImageEntry = ($_POST['ImageEntry']);
$DepositWhere = ($_POST['DepositWhere']);
$YouTubePage = ($_POST['YouTubePage']);
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$filename = $_FILES['file']['name'];
$boundary =md5(date('r', time()));
$headers = "From: [email protected]\r\nReply-To: [email protected]";
$headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";
$message = "Last Name: $LastName\n\n";
$message .= "First Name: $FirstName\n\n";
$message .= "Email: $Email\n\n";
$message .= "Phone: $Phone\n\n";
$message .= "Address1: $Address1\n\n";
$message .= "Address2: $Address2\n\n";
$message .= "City: $City\n\n";
$message .= "State: $State\n\n";
$message .= "Zip: $Zip\n\n";
$message .= "Dealer: $Dealer\n\n";
$message .= "Tripod Monopod Head: $TripodMonopodHead\n\n";
$message .= "Camera Lens: $CameraLens\n\n";
$message .= "Deposit Where: $DepositWhere\n\n";
$message .= "You Tube Page: $YouTubePage\n\n";
$message.="This is a multi-part message in MIME format.
--_1_$boundary
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"
--_2_$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
$message
--_2_$boundary--
--_1_$boundary
Content-Type: application/octet-stream; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--_1_$boundary--";
mail($to, $subject, $message, $headers);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>MailFile</title>
</head>
<body>
<?php echo $output; ?>
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" <?php echo $flags;?>>
<p><label for="LastName" class="barheader">Last Name:</label>
<input name="LastName" type="text" id="LastName" size="28" maxlength="50" />
</p>
<p><label for="FirstName" class="barheader">First Name:</label>
<input name="FirstName" type="text" id="FirstName" size="28" maxlength="50" />
</p>
<p><label for="Email" class="barheader">Email:</label>
<input name="Email" type="text" id="Email" size="50" maxlength="75" />
</p>
<p><label for="Phone" class="barheader">Phone:</label>
<input name="Phone" type="text" id="Phone" size="12" maxlength="15" />
</p>
<p><label for="Address1" class="barheader">Address 1:</label>
<input name="Address1" type="text" id="Address1" size="75" maxlength="100" />
</p>
<p><label for="Address2" class="barheader">Address 2:</label>
<input name="Address2" type="text" id="Address2" size="75" maxlength="100" />
</p>
<p><label for="City" class="barheader">City:</label>
<input name="City" type="text" id="City" size="33" />
</p>
<p><label for="State"><span class="barheader">State:</span></label>
<input name="State" type="text" id="State" size="2" maxlength="2" />
</p>
<p><label for="Zip" class="barheader">Zip:</label>
<input name="Zip" type="text" id="Zip" size="10" maxlength="10" />
</p><label for="Dealer" class="barheader">Dealer:</label>
<input name="Dealer" type="text" id="Dealer" size="100" maxlength="150" />
</p>
<p><label for="Tripod/Monopod/Head Used:" class="barheader">Tripod/Monopod/Head Used:</label>
<input name="TripodMonopodHead" type="text" id="Tripod/Monopod/Head Used:" size="75" maxlength="100" />
</p>
<p><label for="YouTubePage" class="barheader">Camera/Lens Used:</label>
<input name="CameraLens" type="text" id="Camera/Lens Used:" size="75" maxlength="100" />
</p>
<p><label for="Image/Entry:" class="barheader">Image/Entry #:</label>
<input name="ImageEntry" type="text" id="Image/Entry:" size="25" maxlength="25" />
</p>
<p></p>Where will you deposit your entry?:</p>
<p><label for="DepositWhere"></label>
<input name="DepositWhere" type="text" id="DepositWhere:" size="20" maxlength="50" />
</p>
<p><label for="YouTubePage" class="barheader">For YouTube Videos: URL to your YouTube page:</label>
<input name="YouTubePage" type="text" id="YouTubePage" size="50" maxlength="100" />
</p>
<p>
<label for="file">Attach File</label> <input type="file" name="file" id="file"></p>
<input type="submit" name="Submit" id="Submit" value="Submit" />
<input type="reset" name="Reset" id="Reset" value="Reset" />
</form>
</body>
</html>

Similar Messages

  • Is it possible to add an 'Upload Image' option to a form in Muse CC 2014

    Hi,
    Im building a website via Muse and BC for a movie star client who has images of herself tattooed by ardent fans. Basically, the website is a gallery for fans showcasing the very best in inked images of herself on their skin. On the contact form in Muse, I'd like to add an option somewhere for the client to upload an image of their own tattoo to be included in the gallery (which will be added/edited manually in PS).
    Is this possible without too much xtra code? Or, will I need a single page where folks can upload their image to us which will include some sort of widget? I'd like to be able to manage it though without giving out an email address if possible?
    Any help most appreciated.
    Cheers

    Hi Rohit, thank you for that.
    I do have a FormsCentral account and notice on a tutorial I found on AdobeTV, that you can specify file types. This is something I'd like to be able to do as they will be images so PSD, png, jpg etc. But just looking over on BC I see that you can add 'Attach File 250mb limit' to a form (as you advised) but I can't see where you can limit to type? Is it in there?
    Finally, will the image be uploaded to the BC server-side (if I use BC form creation method and not FormsCentral) in some type of assets folder or, will the form simply send any clients uploaded images to the specified email account within the form?
    Whoops, final finally: Do you think that it is better to use FormsCentral for this or BC? I want the page to be customised so the form sits on some b-ground artwork. The client has a famous image where she is holding a burning card invite. I have already used this and overlaid a contact form in Muse which has worked really well, so I want to create a (hidden from menu) uploaded page looking exactly the same and this page will be linked directly from the other Contact page, driving any fans there who wish to then upload an image rather than just send a general contact. I hope that makes sense?
    I guess what Im trying to find out is wether FormsCentral data gets fed back to BC in the same way a BC-created form would be seen in the dashboard area.
    Thanks Rohit

  • Loading images in a table and show this image in a html form

    Hi All,
    I'am a newbie in Oracle and PL/SQL.
    I need to load a image in a table and restrive this image and show it in a html form. I'd like to use a PL/SQL procedure.
    Thanks in advance for any suggestions.

    Hi,
    This forum is for Oracle9iAS Web Services discussion.
    I would recommend that you post your question to the 9iAS - General discussion forum.
    Regards,
    Tim

  • How to get the upload file from a html form ?

    I have a <input type=file ...> control in my form, and the user use that
              control to submit a file
              to my web server. The porblem is the getParameter() function of
              HttpServletRequest only return the
              filename. Does anyone know how to get the file body ?
              Frances
              

    http://www.servlets.com/jsp/examples/ch04/index.html#ex04_17
              Frances Fan <[email protected]> wrote:
              > I have a <input type=file ...> control in my form, and the user use that
              > control to submit a file
              > to my web server. The porblem is the getParameter() function of
              > HttpServletRequest only return the
              > filename. Does anyone know how to get the file body ?
              > Frances
              Dimitri
              

  • Html form in an email body

    hey,
    Actually i, have a requirement to send an html form in the body of an email message( couple of radiob button questions, some checkboxes, etc.) and then read the recipients answers into a java program.
    when i tried sending this form in an email. It went perfectly, but when the recipient click ed on reply, he could not fill the form as only the (html formatted)text was there and all the html controls were gone ie no circle for radio button, no square for checkboxes, etc.
    Can anyone please help me...Thanks in advance.

    I don't know how, or if it's even possible, to send a filled in html form
    as part of an email reply. Normally what I would expect (assuming the
    mail client supports displaying html forms) is that the form would
    appear in the received message and the user would fill it out there
    and then click a "submit" button in the form to send the results back
    via http. The user would not "reply" to the message.
    Better would be to direct the user to a web page that contained the
    form and let them fill it in there.

  • Uploading an image to a servlet with out  html form

    Hello,
    I had a look around the forum and could not find an answer to my question.
    I am trying to unload an image that is in a byte array to a servlet. the image is on the mobile phone. the mobile phone does not have html form to upload the picture.
    Is there any other way of uploading instead of using html form to invoke the servlet. It is just the connection bit that is confusing me. When the servlet is invoked then it can open an inputstream and take in the image.
    I hope this is clear and that some one else has done it.
    thanks
    martin

    search here and/or search google for "send byte array to servlet"
    it's certainly easy to find as far as i can tell
    first google result:
    http://forum.java.sun.com/thread.jspa?messageID=10173137&tstart=0

  • Embed Livecycle form into Outlook email

    Anybody know of a way to, upon clicking submit, embed my form into the actual body of an Outlook email?  Accounting needs this in order to keep an audit trail on monies being transferred.

    You should not embed an html form in an email. While it may work with some email clients, it will not work in most clients.
    Instead you should link to the form that is located on a web server somewhere.
    You could also use Google Docs to create your form and gather replies.

  • Using JSP, HTML Form for uploading image  in order to be saved into a db

    I have a HTML form and I am using <input type="file"> tag. The problem is that I don't know the Java code needed for the JSP page in order to get through the path and get the image(of course I refer to binary object). Below there is the html code
    <%@ page language="java" import="java.sql.*, java.awt.*, java.awt.Event, java.util.*, java.io.*, javax.servlet.*"%>
    <html>
    <head>
    </head>
    <body>
    <div align="left"></div>
    <form action="action.jsp" method="POST" name="form"
    <h1>Add Data</h1>
    <table>
    <tr>
    <td>Name</td>
    <td><input type="text" name="Name" value="" /></td>
    </tr>
    <tr>
    <td>Last Name</td>
    <td><input type="text" name="lastname" value=""/></td>
    </tr>
    <tr>
    <td>Studies</td>
    <td><textarea name="studies" rows="4" cols="20" >
    </textarea>
    </td>
    </tr>
    <tr>
    <td>General Data</td>
    <td><textarea name="gendata" rows="4" cols="20">
    </textarea>
    </td>
    </tr>
    <tr>
    <td>Photo</td>
    <td><input type="File" name="photo"/></td>
    </tr>
    <tr>
    <td> <input type="submit" > </td>
    </tr>
    </table>
    </form>
    If you want to view the Personnel List click here<br>
    Go to index
    </body>
    </html>

    A JSP should not be involved in this. The browser will offer a way to specify a file, and the target of the form should be a servlet that can handle multipart uploads. JSPs should not process any input.
    More info: http://www.jguru.com/faq/view.jsp?EID=160 or Google

  • Uploading File To MySQL from HTML form via Servlet

    Hello all !
    I hope this is better place to ask.
    I'm working on simple Servlet/Jsp application trying to hold to MVC pattern and got stuck on uploading file to MySQL db.
    Here's what I'm trying to accomplish:
    1) client submits a JPEG image via a simple html form on a webpage.
    2) JPEG is put into a database table, column field of type BLOB.
    3) Servlet processes the request, gets a connection to the db and inserts the image into the table.
    4) after that user is able to retrieve an image from db and display it in JSP page.
    This is pretty much the same task Angela was trying to do here:
    http://forum.java.sun.com/thread.jspa?threadID=667597&messageID=3905449
    I could use her snippets if i knew what is what and decided to figure out this myself. Aftet some investigation i found out that i need to import org.apache.commons.fileupload.*;which i found here: http://jakarta.apache.org/commons/fileupload/
    what am i driving at ?
    -----------------------1-----------------------
    After first line of code
    boolean isPart = FileUpload.isMultipartContent(request);netBeans 5.5 beta2 with bundled Tomcat 5.5.17 underlines this with warning saying that
    org.apache.commons.fileupload.FileUploadBase
    has been depreceted
    is it a reason for concern ?
    -----------------------2-----------------------
    Is it actually good idea to store images in db as blob ?
    what about large ammounts of text ?
    thank you
    -Dominik

    is it a reason for concern ?Yes.
    You should take a look at the method in the documentation and find out exact reason for depricating it.
    If it is depricated becouse they going to remove it in the future you should use the new alternative method becouse if you use the old method your app will not work in the future releases of the API.
    If it is depricated becouse it is not safe to use the method you should clearly understand the risks involved in using the method and see if that can give you any trouble in your project.
    -----------------------2-----------------------
    Is it actually good idea to store images in db as
    blob ?I think that it is ths best option available when you want to store binary data
    what about large ammounts of text ?You can use clob columns.
    By the way when you store files in the database its better you put some extra columns to store the file name and file type(mime) becouse you cant directly detect those things later by just looking at the data of the file.

  • Images in HTML forms and/or reports

    Hi,
    Apologies if a stupid question, but can you display a combination of data and image content in Portal HTML forms and/or reports? If so, how?
    This question assumes that the image in question is browser-supported (e.g. gif file), and the link to it is in the same database table as the data being reported (as a bfile data type).
    Alternatively, what if the image was actually directly stored in the database table as a BLOB data type?
    Help!
    Cheers, Jeff

    Hi Sharmila,
    Thanks for the info!
    Would this also work if the image wasn't a blob, but instead just stored on the filesystem (as a gif file), with the reference to it stored in the database as a bfile datatype?
    Thanks once again, Jeff
    Hi,
    You can build portal forms to upload images. You can use blob columns here. You can also have images in a report. This will be the SQL to query data from tables having intermedia data.
    Select a.empno,a.ename,a.mgr,a.sal,
    portal30.wwv_user_utilities.get_intermedia('EMP','EMP_AUDIO','AUDIO',a.rowid)
    the_audio, b.dname,b.loc,
    portal30.wwv_user_utilities.get_intermedia('DEPT','DEPT_PICTURE','IMAGE',b.rowid) the_picture
    from emp a, dept b
    where a.deptno = b.deptno
    The table should have the ordimage column type.
    Thanks,
    Sharmila

  • Can you move a 'Multiple Image Upload' button  into the 'Update Form'?

    I am able to creat and an Update form and an image upload using the "Update Form Wizard" tool and the "Multiple Image Upload" tool succesfully.
    <br />
    <br />The problem comes when I try to move the "UPLOAD" button inside the Update form. Right now it looks like this:
    <br />http://www.webritesolutions.com/Test/upload/now.JPG
    <br />
    <br />This is how I would like it to show:
    <br />http://www.webritesolutions.com/Test/upload/tryingto.JPG
    <br />
    <br />I want to "Upload" button to go next to the "Update record" button. When I do this I get a javascript error and the "Update record" button is disabled.
    <br />Here is the code of what I tried to do:
    <br />
    <br />
    <br />
    <br />
    <br />
    <table>
    <tr class="KT_buttons">
    <td>
    <?php<br />        // Multiple Upload Helper<br /> echo $muploadHelper->Execute();<br /> ?>
    </td>
    <td colspan="1">
    <input type="submit" name="KT_Update1" id="KT_Update1" value="Update record" />
    <br /></td>
    </tr>
    </table>
    <br />
    <br />Here is the Javascript error:
    <br />http://www.webritesolutions.com/Test/upload/error.JPG
    <br />
    <br />thanks for your help.

    A control can only appear once in the visual tree. So you have to remove it from the Grid before you can add it to the DockPanel.
    This code will move the Border element from the Grid to the DockPanel when you click the button:
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    Dim border = CType(LayoutRoot.FindName("myborder"), Border)
    LayoutRoot.Children.Remove(border)
    contain.Children.Add(border)
    End Sub
    <StackPanel>
    <Grid x:Name="LayoutRoot">
    <Border x:Name="myborder" BorderBrush="Black" BorderThickness="2">
    <TextBlock>...</TextBlock>
    </Border>
    </Grid>
    <DockPanel x:Name="contain" Background="Yellow">
    <TextBlock>2</TextBlock>
    </DockPanel>
    <Button Click="Button_Click" Content="Move"/>
    </StackPanel>
    You can try it for yourself. But please post your code as formatted text and not as embedded images if you want anyone to be able to reproduce your issue and help you in the future.
    Please remember to close your threads by marking helpful posts as answer.

  • How to upload Images in Forms 6i

    Dear all,
    How to upload images in Forms 6i and save it in database. Please anyone help me with example.
    Thanking you
    Shekhar

    why do you need an active/X for this?
    Can't you just create 2 default blocks on dept and on emp.
    Use the relationship wizard to define the relation. and set the number of records displayed for the emp block to 10?
    This will give you all you need with no hussle.

  • How to upload a file with a HTML form into a BLOB ?

    Hi,
    I want to upload a file into a BLOB.
    I have created a procedure in PL/SQL whitch generates an html form.
    You can upload a file with <input type="file" name="my_file">.
    How can I insert this file into my database ?
    Thank's for your Help
    Estelle

    Hi Estelle,
    Portal Applications forum is a more apporpriate forum for such questions. Please post your question there.
    Thanks,
    Ravi

  • Can you create an image field in the form so a respondent can upload a photo to it?

    Can you create an image field in the form so a respondent can upload a photo to it?

    Use the File Attachment field to allow respondents to include a photo with their submission.
    Regards,
    Brian

  • Displaying images in HTML Forms inside Servlets

              Dear friends
              How are you?
              I am developing Servlets in WebGain Studio Pro V4.1 VisualCafe
              V4.1 to display dynamic HTML forms with embedded
              images (*.jpg and *.gif).
              Please see the following sample code -
              "<DIV ID=\"Logo\" STYLE=\"position:absolute; left: 4%; top: 4%;
              width: 25%; height: 12%; z-index:1; visibility:visible\">" +
              "<IMG SRC=\"FigLogo.gif\" WIDTH=\"100%\" HEIGHT=\"100%\">" +
              "</DIV>"
              Then I deploymed servlets to BEA WLS 6.0 by including Servlets
              in the Web.xml file. However, I do not see the images when
              viewed in IE5.0 browser.
              I appreciate all comments and suggestions.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              

              Dear Friends
              How are you?
              I moved all images (*.jpg, *.gif) to the subdirectory
              /myDomain/applications/DefaultWebApp_myServer/images
              and they are displaying now in the servlets with HTML forms.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              "Sriram (Ram) Peddibhotla" <[email protected]> wrote:
              >
              >Dear Friends
              >
              >How are you?
              >
              >When the Servlet displays in the browser (IE5.0), when I click on where
              >the image
              >should be, I see the path
              >http://localhost:7001/servlet/FigureName.jpg (????). Why did it add
              >the /servlet
              >part to the path, I thought that was exclusively for deploying servlets
              >in web.xml
              >file.
              >
              >Thanking you
              >Very truly yours
              >Sriram (Ram) Peddibhotla, PhD
              >
              >
              >"Xiang Rao" <[email protected]> wrote:
              >>
              >>Check access.log to see the status of your image request (status code
              >>and response
              >>size). You can also check weblogic.log. On the other hand, IE cache
              >setup
              >>(e.g.,
              >>"Never") could cause this problem.
              >>
              >>"Sriram (Ra) Peddibhotla" <[email protected]> wrote:
              >>>
              >>>Dear friends
              >>>
              >>>How are you?
              >>>
              >>>I am developing Servlets in WebGain Studio Pro V4.1 VisualCafe
              >>>V4.1 to display dynamic HTML forms with embedded
              >>>images (*.jpg and *.gif).
              >>>
              >>>Please see the following sample code -
              >>>"<DIV ID=\"Logo\" STYLE=\"position:absolute; left: 4%; top: 4%;
              >>>width: 25%; height: 12%; z-index:1; visibility:visible\">" +
              >>>"<IMG SRC=\"FigLogo.gif\" WIDTH=\"100%\" HEIGHT=\"100%\">" +
              >>>"</DIV>"
              >>>
              >>>Then I deploymed servlets to BEA WLS 6.0 by including Servlets
              >>>in the Web.xml file. However, I do not see the images when
              >>>viewed in IE5.0 browser.
              >>>
              >>>I appreciate all comments and suggestions.
              >>>
              >>>Thanking you
              >>>Very truly yours
              >>>Sriram (Ram) Peddibhotla, PhD
              >>>          
              >>
              >
              

Maybe you are looking for