Solved

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

Posted on 2002-06-23
9
316 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replace quotes with UTF-8 character 38 108
Forcing form refresh - classic ASP 7 73
Need help editing script 3 80
Issues with Insert statement 12 29
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 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