HELP with ASP Form PLEASE
03-10-2006, 10:44 PM
|
HELP with ASP Form PLEASE
|
Posts: 2
Location: Vancouver. BC
|
Hi,
I am a webdesigner however not a very good developer or programmer, and very new to ASP.
I need to set up a form so that clients can give feedback and also upload their drawings/files for quotes and stuff.
The form mail script (gdform.asp) given by my host (goddady) doesn't seem to support file uploads and they wouldn't help me fix/customize the one they gave me (gdform.asp) by default either.
Does anyone has or knows how to write a Form mail script (asp) that contains file uploads capabilities?.
I want to get the results send as an email message to my email account when users submit their info and upload files from the form.
I would really appreciate if anyone can help me with this.
|
|
|
|
03-11-2006, 04:14 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 11,894
Location: Blackpool. UK
|
You will not be able to do both at once, file uploading is done with a binary read/write in ASP and does not allow the use of any other form processing.
ASP file upload
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
|
|
|
|
03-11-2006, 06:53 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 317
Name: This Space for Rent
Location: Georgia
|
With conventional fso, chris is right. However, since you are using godaddy for your hosting you can use persist asp upload ( http://www.aspupload.com/). It allows you the ability to upload, post to a database and send an email from one form.
Check out the site and see if it fits your needs.
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
|
|
|
|
03-11-2006, 08:26 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 317
Name: This Space for Rent
Location: Georgia
|
Create an upload page called upload.asp with the following
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Upload Photos</TITLE>
</HEAD>
<BODY>
<form action="send.asp" method="POST" enctype="multipart/form-data" name="ADD_PHOTO" id="ADD_PHOTO">
Your Email
<input name="EMAIL" type="text" id="EMAIL">
<br>
Message:
<textarea name="EMAIL_MESSAGE" cols="40" id="EMAIL_MESSAGE"></textarea>
<br>
Browse:
<input name="FILE_NAME" type="file" id="FILE_NAME">
<input name="Submit" type="submit" value="Upload">
</form>
</BODY>
</HTML>
----Create a file called send.asp----
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = False
'set the path to upload files to --- special permissions will have to be set on this folder to allow upload
Upload.Save Server.MapPath("upload")
%>
<% 'set up and send email
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
'----edit these lines to fit your needs-----
objCDO.From = cStr(Upload.Form("EMAIL")) 'email sent from
objCDO.To = "EMAIL@gmail.com" 'email sent to
objCDO.Subject = "This is the subject line" 'subject line
objCDO.Body = cStr(Upload.Form("EMAIL_MESSAGE")) 'body of email
'----do not edit these lines----------
objCDO.Send() 'send mail
Set objCDO = Nothing
'----edit this lines to fit your needs-----
Response.Write("Upload was successful and email was sent<br>") 'send a message to the user
%>
<% 'here are all your varuables
Response.Write(Upload.Form("EMAIL")&"<br>")
Response.Write(Upload.Form("EMAIL_MESSAGE"))
%>
Now create a folder in the same directory called "upload". Use the control panel from godaddy to set up special permissions to write to this folder.
thats it
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
Last edited by ExpressoDan : 07-19-2006 at 04:41 PM.
|
|
|
|
03-12-2006, 02:35 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 2
Location: Vancouver. BC
|
Thanx very much you guys, I will try these solutions and see how it goes.
|
|
|
|
03-13-2006, 02:30 PM
|
Re: HELP with ASP Form PLEASE
|
Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
webgenio: before you get too wrapped up in ASPUpload (it's a great component by the way), read the docs over at least twice first. There are certain things you do have to code differently with ASPUpload (e.g. Upload.Form instead of Request.Form) or it won't work.
Version 3.0 also has some cool features in it, like being able to extract the width and height of a JPG (I think 2.1 had it too but I can't remember), file size, and other fun stuff. So read it over and learn it well.
Out of all the third-party ASP components out there, this is the one I've gotten the most use from by far.
|
|
|
|
03-28-2006, 04:59 PM
|
Re: HELP with ASP Form PLEASE
|
Posts: 1
Location: Boston, Ma
|
hi all...
i have a new site on GoDaddy and have not been able to get file uploading to work - godaddy does support AspUpload - however, the .Save command has been disabled and i have been told to use .SaveVirtual instead - i am still not having success - i think that it has to do with permissions on the virtual directories...
still looking for help...
ron...
|
|
|
|
03-29-2006, 02:56 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
Ron: what error message(s) do you get?
And are you the same Ron Barber from EBL by any wild chance? (And if so, when did you move from Florida?)
|
|
|
|
05-11-2006, 07:12 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 1
|
Glad to hear I am not the only one having this problem. I too am hosted with goDaddy.com and am currently sending and receiving emails with their support team.
So far I have had from goDaddy:
"Unfortunately, we are unable to troubleshoot custom script" Amanda P.
"You might want to check our Help Center located at http://help.godaddy.com" Deirdre P.
"I am sorry, as stated previously Customer Support is not able to provide support and troubleshooting for coding and scripting issues" Jason P
To which my reply have been:
"I have looked extensively under your Help Centre with no result. On
searching the web, it seems I am not the only one with this problem, see
article number 7 on
http://www.webmaster-talk.com/asp-fo...rm-please.html
"
"THIS IS NOT A SCRIPTING ISSUE! TRY A PAGE FOR YOURSELF!!! IT IS A PROBLEM WITH YOUR HOSTING SETUP."
"Im glad that you can provide such an easy answer but unfortunately that is not very good customer support for someone who pays for your service.
Therefore, can I ask that you compare the folder permission of the lucky few whose work with mine and perhaps their code because there is something wrong with your setup."
and where am i now.... still at the beginning.!!
|
|
|
|
05-11-2006, 09:02 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 317
Name: This Space for Rent
Location: Georgia
|
Yeah, I have had this issue too... I think I found the article that I used to solve the problem. The SaveAsVirtual includes the Server.Mappath("/") in the object. So, where you would normally write: Upload.Save Server.MapPath("upload") you would replace it with Upload.SaveAsVirtual "/upload/" & File.FileName
Quote:
Same as SaveAs, but expects a virtual rather than physical path. If the system admin disables SaveAs, users will be forced to use SaveAsVirtual which confines them to their home directory and subdirectories.
Usage:
File.SaveAsVirtual "/path/" & File.FileName
|
Hope this helps...
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
|
|
|
|
05-18-2006, 03:45 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 4
|
great post
|
|
|
|
04-06-2007, 07:52 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 2
Name: Seungman Kim
|
I had same problem.... However, I solved the problem.
Anybody didn't say that there are two requirements...
Firstly, you have to make custom directories which has writing permission.
- 1. Open hostong manager
- 2. Contents > Directory Management
- 3. Create directiry (Select read and write permissions)
e.g) upload_directory
Secondly, use 'Upload.SaveVirtual "/upload_directory/"' in your script.
* Good luck
|
|
|
|
04-24-2007, 09:07 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 4
Name: Damien
|
Microsoft VBScript compilation error '800a0400'
Expected statement
/send.asp, line 7
"Upload.SaveAsVirtual "/upload_directory/"
^
do you know what ive done wrong?
|
|
|
|
04-24-2007, 10:24 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 4
Name: Damien
|
How do I upload to a data directory?
You may upload up to three files and the corresponding asp script to a data directory by creating the following HTML form:- upload.html
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="upload.asp">
<INPUT TYPE= FILE SIZE= 60 NAME="FILE1"> <BR>
<INPUT TYPE= FILE SIZE= 60 NAME="FILE2"> <BR>
<INPUT TYPE= FILE SIZE= 60 NAME="FILE3"> <BR>
<INPUT TYPE="SUBMIT" VALUE="Upload!">
</FORM>
</BODY>
</HTML>
- upload.asp
<% Set Upload = Server.CreateObject ("Persits.Upload.1")
Count = Upload.SaveVirtual ("/data") %>
<% = Count %> file(s) uploaded.
THIS WORKS!!!!!!
|
|
|
|
04-24-2007, 10:35 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
Okay...so are you asking a question or did you just answer your own?
|
|
|
|
04-27-2007, 03:35 AM
|
Re: HELP with ASP Form PLEASE
|
Posts: 14
Name: nick
|
good post
|
|
|
|
05-14-2007, 09:51 PM
|
Re: HELP with ASP Form PLEASE
|
Posts: 2
|
Quote:
Originally Posted by ExpressoDan
]----Create a file called send.asp----
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = False
'set the path to upload files to --- special permissions will have to be set on this folder to allow upload
Upload.Save Server.MapPath("upload")
%>
<% 'set up and send email
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
'----edit these lines to fit your needs-----
objCDO.From = cStr(Upload.Form("EMAIL")) 'email sent from
objCDO.To = "EMAIL@gmail.com" 'email sent to
objCDO.Subject = "This is the subject line" 'subject line
objCDO.Body = cStr(Upload.Form("EMAIL_MESSAGE")) 'body of email
'----do not edit these lines----------
objCDO.Send() 'send mail
Set objCDO = Nothing
'----edit this lines to fit your needs-----
Response.Write("Upload was successful and email was sent<br>") 'send a message to the user
%>
<% 'here are all your varuables
Response.Write(Upload.Form("EMAIL")&"<br>")
Response.Write(Upload.Form("EMAIL_MESSAGE"))
%>
Now create a folder in the same directory called "upload". Use the control panel from godaddy to set up special permissions to write to this folder.
thats it
|
I used this code and got it to work, but I need to have more fields emailed into the body instead of just the EMAIL_MESSAGE. How can I add more? I tried it but all it does is send the first one that I have set up:
Code:
objCDO.Body = cStr(Upload.Form("NAME"))
cStr(Upload.Form("PHONE"))
cStr(Upload.Form("COMPANY"))
cStr(Upload.Form("EMAIL"))
cStr(Upload.Form("ADDRESS"))
I also tried this with no luck:
Code:
objCDO.Body = cStr(Upload.Form("NAME"))
objCDO.Body = cStr(Upload.Form("PHONE"))
objCDO.Body =cStr(Upload.Form("COMPANY"))
objCDO.Body =cStr(Upload.Form("EMAIL"))
objCDO.Body =cStr(Upload.Form("ADDRESS"))
I'm sure it's really simple, I just don't know much about ASP.
|
|
|
|
05-14-2007, 10:05 PM
|
Re: HELP with ASP Form PLEASE
|
Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
Dim Email_Body
Email_Body = cStr(Upload.Form("NAME"))
Email_Body = Email_Body & " " & cStr(Upload.Form("ADDRESS"))
ObjCDO.Body = Email_Body
|
|
|
|
|