Solved

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

Posted on 2002-06-23
9
326 Views
Last Modified: 2012-06-27
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

0
Comment
Question by:garymgordon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 30

Expert Comment

by:third
ID: 7102414
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
0
 

Author Comment

by:garymgordon
ID: 7102466
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
0
 
LVL 30

Expert Comment

by:third
ID: 7102507
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>
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:garymgordon
ID: 7102591
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
0
 
LVL 30

Accepted Solution

by:
third earned 150 total points
ID: 7102643

<%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, filepath
urlSendTo  = "thankyou_emaillist.asp"
filepath   = "c:\Inetub\database\"

Dim upl, FileName
 
Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
 
If Len(upl.Form("File1")) > 0 Then
    FileName = filepath & upl.ExtractFileName(upl.Form("File1"))
    If upl.SaveFile("File1",FileName) Then
      'Response.Write "Form information submitted..."
      Response.Redirect urlSendTo
    Else
        Response.Write("There was an error saving the file to disk.")
    End If
End If
%>
</body>
</html>


before this you should have a form that will look like where you will input the file to be attached. just change the form action as desired.

<html><head><title>ASP Simple Upload Example #1</title></head></title>
<body>
<form method="POST" action="upload.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>
0
 

Author Comment

by:garymgordon
ID: 7102712
third,

Still not working.

Gary
0
 
LVL 30

Expert Comment

by:third
ID: 7102716
any error message? can i see your code the part that has the file input and the target as well.
0
 

Author Comment

by:garymgordon
ID: 7103331
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
0
 
LVL 4

Expert Comment

by:Wakie
ID: 9355456
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

617 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