Chillipowder
asked on
asp smartupload and request form for jmail not working
hello,
i have a form where the user can enter some values and upload a file. After the form is sent i need the following things to be done:
upload the attached file
gather the informations from the form
build an email with jmail 3.7 and send the informations and the uploaded file to a specific mail-adress
delete the uploaded file
My problem is, that when i want to gather the informations from the form with a request.form, that i get the following errror
BinaryRead could not be called
/anfrage_ersatz_danke.asp, line 51
After using the collection Request.Form you cant call the BinaryRead.
here is the source:
<%
firma=Request.form("firma" )
ansprech=Request.form("ans prech")
strasse=Request.form("stra sse")
plz=Request.form("plz")
ort=Request.form("ort")
tel=Request.form("tel")
fax=Request.form("fax")
email1=Request.form("email 1")
mothersteller=Request.form ("motherst eller")
motnr=Request.form("motnr" )
mottyp=Request.form("motty p")
klass=Request.form("klass" )
schiffsherst=Request.form( "schiffshe rst")
teileliste=Request.form("t eileliste" )
lieferbed=Request.form("li eferbed")
email="anfrage-Ersatzteile @xx.de"
msg = "Firma: " & firma
msg = msg & "Ansprechpartner: " & ansprech & vbcrlf
msg = msg & "Strasse: " & Strasse & vbcrlf
msg = msg & "Plz / Ort: " & plz & " " & ort & vbcrlf
msg = msg & "Telefon: " & telefon & vbcrlf
msg = msg & "Fax: " & fax & vbcrlf
msg = msg & "E-Mail: " & email1 & vbcrlf
msg = msg & "Motorenhersteller : " & mothersteller & vbcrlf
msg = msg & "Motorennummer: " & motnr & vbcrlf
msg = msg & "Mottyp: " & mottyp & vbcrlf
msg = msg & "Motorenhersteller : " & mothersteller & vbcrlf
msg = msg & "Klassifizierung: " & klass & vbcrlf
msg = msg & "Schiffshersteller: " & schiffsherst & vbcrlf
msg = msg & "Angefragte Teile : " & teileliste & vbcrlf
msg = msg & "Lieferbedingungen : " & lieferbed & vbcrlf
%>
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim intCount
dim FileName
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSm artUpload. SmartUploa d")
' Upload
' ******
mySmartUpload.Upload
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' ************************** ********** ********** ********** ********** ********
file.SaveAs("/~Upload/" & file.FileName)
' Display the properties of the current file
' ************************** ********** ******
Response.Write("Name = " & file.Name & "<BR>")
Response.Write("Size = " & file.Size & "<BR>")
Response.Write("FileName = " & file.FileName & "<BR>")
Response.Write("FileExt = " & file.FileExt & "<BR>")
Response.Write("FilePathNa me = " & file.FilePathName & "<BR>")
Response.Write("ContentTyp e = " & file.ContentType & "<BR>")
Response.Write("ContentDis p = " & file.ContentDisp & "<BR>")
Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
Response.Write("SubTypeMIM E = " & file.SubTypeMIME & "<BR>")
FileName = File.FileName
intCount = intCount + 1
End If
Next
' Display the number of files which could be uploaded
' ************************** ********** ********** *****
' Response.Write("<BR>" & mySmartUpload.Files.Count & " files could be uploaded.<BR>")
' Display the number of files uploaded
' ************************** **********
' Response.Write(intCount & " file(s) uploaded.<BR>")
%>
<%
Set JMail = Server.CreateObject("JMail .SMTPMail" )
JMail.ServerAddress = "xxx.de"
JMail.Sender = email
JMail.Subject = "What"
JMail.AddRecipient "info@nn.de"
JMail.AddAttachment Server.MapPath("/~Upload/" & FileName)
JMail.Body = msg
JMail.Execute
' Call function
Call DeleteFile(Server.MapPath( "/~Upload/ " & FileName))
%>
<%
Function DeleteFile(strPathToFile)
Dim objFSO
Set objFSO = Server.CreateObject("Scrip ting.FileS ystemObjec t")
If (objFSO.FileExists(strPath ToFile)) = true Then
objFSO.DeleteFile(strPathT oFile)
End If
Set objFSO = Nothing
Set JMail = Nothing
End Function
%>
i have a form where the user can enter some values and upload a file. After the form is sent i need the following things to be done:
upload the attached file
gather the informations from the form
build an email with jmail 3.7 and send the informations and the uploaded file to a specific mail-adress
delete the uploaded file
My problem is, that when i want to gather the informations from the form with a request.form, that i get the following errror
BinaryRead could not be called
/anfrage_ersatz_danke.asp,
After using the collection Request.Form you cant call the BinaryRead.
here is the source:
<%
firma=Request.form("firma"
ansprech=Request.form("ans
strasse=Request.form("stra
plz=Request.form("plz")
ort=Request.form("ort")
tel=Request.form("tel")
fax=Request.form("fax")
email1=Request.form("email
mothersteller=Request.form
motnr=Request.form("motnr"
mottyp=Request.form("motty
klass=Request.form("klass"
schiffsherst=Request.form(
teileliste=Request.form("t
lieferbed=Request.form("li
email="anfrage-Ersatzteile
msg = "Firma: " & firma
msg = msg & "Ansprechpartner: " & ansprech & vbcrlf
msg = msg & "Strasse: " & Strasse & vbcrlf
msg = msg & "Plz / Ort: " & plz & " " & ort & vbcrlf
msg = msg & "Telefon: " & telefon & vbcrlf
msg = msg & "Fax: " & fax & vbcrlf
msg = msg & "E-Mail: " & email1 & vbcrlf
msg = msg & "Motorenhersteller : " & mothersteller & vbcrlf
msg = msg & "Motorennummer: " & motnr & vbcrlf
msg = msg & "Mottyp: " & mottyp & vbcrlf
msg = msg & "Motorenhersteller : " & mothersteller & vbcrlf
msg = msg & "Klassifizierung: " & klass & vbcrlf
msg = msg & "Schiffshersteller: " & schiffsherst & vbcrlf
msg = msg & "Angefragte Teile : " & teileliste & vbcrlf
msg = msg & "Lieferbedingungen : " & lieferbed & vbcrlf
%>
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim intCount
dim FileName
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSm
' Upload
' ******
mySmartUpload.Upload
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' **************************
file.SaveAs("/~Upload/" & file.FileName)
' Display the properties of the current file
' **************************
Response.Write("Name = " & file.Name & "<BR>")
Response.Write("Size = " & file.Size & "<BR>")
Response.Write("FileName = " & file.FileName & "<BR>")
Response.Write("FileExt = " & file.FileExt & "<BR>")
Response.Write("FilePathNa
Response.Write("ContentTyp
Response.Write("ContentDis
Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
Response.Write("SubTypeMIM
FileName = File.FileName
intCount = intCount + 1
End If
Next
' Display the number of files which could be uploaded
' **************************
' Response.Write("<BR>" & mySmartUpload.Files.Count & " files could be uploaded.<BR>")
' Display the number of files uploaded
' **************************
' Response.Write(intCount & " file(s) uploaded.<BR>")
%>
<%
Set JMail = Server.CreateObject("JMail
JMail.ServerAddress = "xxx.de"
JMail.Sender = email
JMail.Subject = "What"
JMail.AddRecipient "info@nn.de"
JMail.AddAttachment Server.MapPath("/~Upload/"
JMail.Body = msg
JMail.Execute
' Call function
Call DeleteFile(Server.MapPath(
%>
<%
Function DeleteFile(strPathToFile)
Dim objFSO
Set objFSO = Server.CreateObject("Scrip
If (objFSO.FileExists(strPath
objFSO.DeleteFile(strPathT
End If
Set objFSO = Nothing
Set JMail = Nothing
End Function
%>
http://www.dmxzone.com/ShowDetail.asp?NewsId=1091
ASKER
i am not using pure-upload. I know this extension and i use it. But in this case i use smartupload. Do you think, that the solution is in this case still valid.
Thanks
Thanks
You cannot use the Request object when uploading (BinaryRead). Take a look at the SmartUpload for alternatives to using Request.
ASKER
Hello,
i aleady had a look at the samples from their website. But i am not an expert and i still dont know how to write the script. Can someone write me the script for just two form fields, so that i understand how to write the whole script
i aleady had a look at the samples from their website. But i am not an expert and i still dont know how to write the script. Can someone write me the script for just two form fields, so that i understand how to write the whole script
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.