Solved

asp smartupload and request form for jmail not working

Posted on 2004-04-18
8
724 Views
Last Modified: 2012-05-04
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("ansprech")
strasse=Request.form("strasse")
plz=Request.form("plz")
ort=Request.form("ort")
tel=Request.form("tel")
fax=Request.form("fax")
email1=Request.form("email1")
mothersteller=Request.form("mothersteller")
motnr=Request.form("motnr")
mottyp=Request.form("mottyp")
klass=Request.form("klass")
schiffsherst=Request.form("schiffsherst")
teileliste=Request.form("teileliste")
lieferbed=Request.form("lieferbed")
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("aspSmartUpload.SmartUpload")

'  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("FilePathName = " & file.FilePathName & "<BR>")
         Response.Write("ContentType = " & file.ContentType & "<BR>")
         Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")
         Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
         Response.Write("SubTypeMIME = " & 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("Scripting.FileSystemObject")

   If (objFSO.FileExists(strPathToFile)) = true Then
      objFSO.DeleteFile(strPathToFile)
   End If

   Set objFSO = Nothing
   Set JMail = Nothing

End Function

%>
0
Comment
Question by:Chillipowder
  • 2
  • 2
8 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10853403
0
 

Author Comment

by:Chillipowder
ID: 10854479
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
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 10855294
You cannot use the Request object when uploading (BinaryRead).  Take a look at the SmartUpload for alternatives to using Request.
0
 

Author Comment

by:Chillipowder
ID: 10858113
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
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
ID: 10859842
I have never used aspSmartUpload, but the sample here should get you going:
http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=258&L=EN#5

You need to replace your Request object with aspSmartUpload.Form collection.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding items to html ul from on server side. 4 55
Round to 2 decimal places 2 40
CSS Question.. 3 77
XML Parsing Classic ASP 5 50
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now