Form to Email Photo attachment

This is a discussion on "Form to Email Photo attachment" within the Classic ASP section. This forum, and the thread "Form to Email Photo attachment are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Oct 17th, 2007, 14:22
New Member
Join Date: Oct 2007
Location: California
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Form to Email Photo attachment

hello everyone
First I am a novice.
I have a form I use to gather user stories, which in turn is emailed to me.
I now want to integrate photo inclusion by providing the user with the option of adding a photo to form input and having the photo become an attachment to the email.
Can someone tell me what code I need to add?
Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 17th, 2007, 15:38
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form to Email Photo attachment

Here's a simple upload script. See it you can make this work for you. Feel free to ask ?'s...
PHP: Select all

<?php
if(isset($_FILES['uploadfile'])) { // check for submitted file
    
$message='';
    switch(
$_FILES['uploadfile']['error']) {
        case 
UPLOAD_ERR_OK:
            if(
move_uploaded_file($_FILES['uploadfile']['tmp_name'],$real_path.$_FILES['uploadfile']['name'])) {
                
$message.='Upload successful.';
            } else {
                
$message.='Upload failed.';
            }
            break;
        case 
UPLOAD_ERR_INI_SIZE:
        case 
UPLOAD_ERR_FORM_SIZE:
            
// file too large
            
$message.='File is too large.';
            break;
        default:
            
// file upload failed
            
$message.='Upload failed.';
            break;
    }
}
echo((
$message==''?'':'<p>'.$message.'</p>'));
?>
<form name="upload_form" action="<?php echo($link_prefix); ?>fileshare/upload/" method="post" enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
    <p><input type="file" name="uploadfile" /></p>
    <p><input type="submit" action="submit" value="upload" /></p>
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 17th, 2007, 15:49
New Member
Join Date: Oct 2007
Location: California
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form to Email Photo attachment

Many Thanks
I'll keep you informed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 17th, 2007, 15:50
New Member
Join Date: Oct 2007
Location: California
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form to Email Photo attachment

I see this script is php.
My script is ASP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Oct 17th, 2007, 17:55
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form to Email Photo attachment

Quote:
Originally Posted by septemberq View Post
I see this script is php.
My script is ASP
oops, sorry. I thought this was the PHP forum.

Sorry, I'm not so familiar with ASP, so I can't help you further.

but, Good Luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Oct 19th, 2007, 07:15
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Form to Email Photo attachment

LOL,
I'm also searching how to do that in asp.

Anybody can help us
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Oct 23rd, 2007, 09:02
Up'n'Coming Member
Join Date: Aug 2007
Location: Haverhill
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Form to Email Photo attachment

Do you have some web space where the images can be uploaded to before being attached to the email?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Oct 24th, 2007, 17:09
Up'n'Coming Member
Join Date: Aug 2007
Location: Haverhill
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Form to Email Photo attachment

In the form people are using to post to you insert the following field
HTML: Select all
<INPUT type="file" id=file1 name=file1>
Then on the page that the form posts to include the file clsUpload.asp which I have attached as clsUpload.txt (just save a copy as clsUpload.asp should work fine), and also enter the code below on the same page.

Code: Select all
'FILE UPLOAD
'------------------------------------------------------------
set o = new clsUpload
if  o.FileNameOf("file1") <> "" then
  sFileSplit = split(o.FileNameOf("file1"), "\")
  sFile = sFileSplit(Ubound(sFileSplit))
  o.FileInputName = "file1"
  o.FileFullPath = Server.MapPath(".") & "\email\images\" & sFile
  'the above line puts the file image into the folder images in the folder email in the root directory
  o.save
   if o.Error = "" then
   response.write "Success. " & o.FileFullPath  & "<br><br>"
   else
   response.write "Failed due to the following error: " & o.Error
   end if
   sFile1 = sFile
    response.write(sFile1)
Else
   'sFile1 = sFile  
   'does not work if this else is removed. Don't Know Why.
end if
What this should do is upload the image into the folder images in the folder email in the root directory of the web page.

There is more code for then attaching these images to an e-mail however if you have access to the site you should be able to access the images from here directly.
Attached Files
File Type: txt clsUpload.txt (11.5 KB, 6 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating HTML form that allows image attachment stanwaka Web Page Design 6 Jan 24th, 2008 10:21
Form submits to email via php, but email is blank!!?? DH1234 PHP Forum 2 Jun 18th, 2007 10:42
Email + attachment sending manzil PHP Forum 1 Aug 4th, 2006 13:40
Need to create a photo gallery and send pics by email jaxsjaks PHP Forum 5 Dec 21st, 2005 16:25
Send Email w/ Attachment from ASP form laundrymedia Classic ASP 3 Nov 7th, 2003 20:44


All times are GMT. The time now is 06:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42