Link to home
Start Free TrialLog in
Avatar of Gary Gordon
Gary GordonFlag for United States of America

asked on

I have an ASPUpload script that I need converted to ASP Simple Upload. HELP??

I have a script that works fine with ASPUpload.  But a new server I am on doesn't have this .. and it only has ASP Simple Upload.  I simply need BIG help in converting the code so it will do the same thing .. but using ASP Simple Upload as opposed to the prior ASPUpload.

If you can help me .. here's the ASPUpload script.

I just need it re-done.

Also, I need it to write the files to a folder that is below the root folder of the website, in a folder already called   "database" .   That's about the only change.  Everything else stays exactly the same.

I kind of need help on this asap.  And, if I get it working quickly, I will gladly double the points.

Thanks,
Gary

Here's the current ASPUpload script.  (The form page forwards the info to this asp script for processing.)


<%response.buffer=true%>
<html>
<head>
     <title>Gordon Designs - Response Form</title>
</head>

<body bgcolor="white">
<h3><font face="arial">Thank You</font></h3>

<%

dim urlSendTo
urlSendTo  = "thankyou_emaillist.asp"

Set oUpload = Server.CreateObject("Persits.Upload.1")

oUpload.OverwriteFiles = false 'Create unique filenames by appending (1),(2) ... (n)
FileCount = oUpload.SaveVirtual("/files") 'This needs to be changed so it writes to a folder called (database) which is located one folder beneath the root folder.

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName   = "Gordon Designs"
Mailer.FromAddress= "info@gordondesigns.com"
Mailer.RemoteHost = "mail.gordondesigns.com"
Mailer.AddRecipient "Gordon Designs", "ggordon@gordondesigns.com"

'Mailer.AddRecipient Request.Form("recipient"), Request.Form("recipient")

Mailer.Subject = "Gordon Designs - Email Data"

strMsgHeader = " - Email Form Information Follows - " & vbCrLf & vbCrLf

'this routine has changed.  You can use the request object with uploading....
'instead of Request.Form you must use uploadobject.form as below

'for each qryItem in oUpload.Form
for each qryItem in oUpload.Form
'   strMsgInfo = strMsgInfo &  qryItem & " :: " & oUpload.Form(qryItem) & vbCrLf & vbCrLf
   strMsgInfo = strMsgInfo &  qryItem.name & " :: " & qryItem.value & vbCrLf & vbCrLf
next

'If items were uploaded, attachthem to this email.
If FileCount > 0 Then
     for each file in oUpload.Files
          Mailer.AddAttachment(Server.MapPath("/files/" & file.filename))
     Next
End If
strMsgFooter = vbCrLf & vbCrLf & " - End Of This Email Form Information - " & vbCrLf

Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter & vbcrlf & FileCount & " files attached."


if Mailer.SendMail then
  'Response.Write "Form information submitted..."
  Response.Redirect urlSendTo

else

  Response.Write "Mail send failure. Error was " & Mailer.Response

end if

set Mailer=nothing

%>

</body>
</html>


Please help asap. And if you have any comments about how to fix up the above code, that would also be appreciated.

Thanks!!
Gary

Avatar of third
third
Flag of Philippines image

i think the script was from a SMTP mail component rather than from a ASPUpload component. when you upload a file to a server the local file on your pc is being sent to the server on the desired directory while when you send a mail having an attachement, your local file is sent to an email address and the attachment can only be retrieve by downloading again the file from the POP Mail server where the mail was sent.

anyway, if you need to know more about how to use ASP Simple Upload this link provides a detailed explanation/documentation about using the component. it includes examples too.

http://www.asphelp.com/ASPSimpleUpload/Docs/Default.htm


regards,

third
Avatar of Gary Gordon

ASKER

third,

I guess what I need and was hoping someone like you might be able to help me with is .. to simply take the original script .. and just modify what is needed so it will work with ASP Simply Upload.

Is this something you can help me with??

Gary
try this,


Example1.asp  
-----------------
<%
 Option Explicit
   
 Dim upl, FileName
   
 Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
 
 If Len(upl.Form("File1")) > 0 Then
     FileName = upl.ExtractFileName(upl.Form("File1"))
     If upl.SaveFile("File1","c:\Inetpub\database\" & FileName) Then
         Response.Write("File successfully written to disk.")  
     Else
         Response.Write("There was an error saving the file to disk.")
     End If
 End If
 %>
   
 <html><head><title>ASP Simple Upload Example #1</title></head></title>
 <body>
 <form method="POST" action="Example1.Asp" enctype="multipart/form-data">
 
 Select a file to upload: <input type="file" name="File1" size="30">
 <input type="submit" name="submit" value="Upload Now">
 </form>
 </body>
</html>
third,

I appreciate the effort, but it is not what I need.

If you can, simply take the code I wrote above (initially) and modify it to work with ASP Simple Upload.

Thanks,
Gary
ASKER CERTIFIED SOLUTION
Avatar of third
third
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
third,

Still not working.

Gary
any error message? can i see your code the part that has the file input and the target as well.
Third,

Aside from the "FILEPATH" c:\Inetub\database\ ... can you simply take my exact thing that I put above ... fix it so it should work with ASP Simple Upload and paste it back in here.  Then, I should be able to copy and paste it and it should work.

Can you try that and then I'll let you know what I get.  That's really what I think I need.

Thanks,
Gary
It appears this question has been abandoned.

I will leave a recommendation in the Cleanup topic area that this question will be:

- Points to third -

Please leave any comments here within the next seven days.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Wakie,
EE Cleanup Volunteer.