%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 5000000
%>
<%
' ****************************************************
' Change the value of the variable below to the pathname
' of a directory with write permissions, for example "C:\Inetpub\wwwroot"
Dim uploadsDirVar
uploadsDirVar = "g:\newsimra\graphics\uploadspl"
' ****************************************************
function OutputForm()
%>
<%
end function
function TestEnvironment()
Dim fso, fileName, testFile, streamTest
TestEnvironment = ""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FolderExists(uploadsDirVar) then
TestEnvironment = "Folder " & uploadsDirVar & " does not exist.
The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
fileName = uploadsDirVar & "\test.txt"
on error resume next
Set testFile = fso.CreateTextFile(fileName, true)
If Err.Number<>0 then
TestEnvironment = "Folder " & uploadsDirVar & " does not have write permissions.
The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
Err.Clear
testFile.Close
fso.DeleteFile(fileName)
If Err.Number<>0 then
TestEnvironment = "Folder " & uploadsDirVar & " does not have delete permissions, although it does have write permissions.
Change the permissions for IUSR_computername on this folder."
exit function
end if
Err.Clear
Set streamTest = Server.CreateObject("ADODB.Stream")
If Err.Number<>0 then
TestEnvironment = "The ADODB object Stream is not available in your server.
Check the Requirements page for information about upgrading your ADODB libraries."
exit function
end if
Set streamTest = Nothing
end function
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey, nname,fso, objMail, objMail2, mailres, mailres2, bodystring, bodystringpl, filesmail, dest
Set Upload = New BVASPUpload
Upload.Save(uploadsDirVar)
' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "FILES UPLOADED:"
for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & " " & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B)"
filesmail = filesmail & " " & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B)"
nname = uploadsDirVar&"\"&Upload.UploadedFiles(fileKey).FileName
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.moveFile nname, uploadsDirVar&"\"&Upload.Form("enter_a_number")&"_"&Upload.UploadedFiles(fileKey).FileName
next
SaveFiles = SaveFiles & "
An e-mail has been sent to "& Upload.Form("email")&" with your upload confirmation. A representative will be notified of your upload."
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
bodystring = bodystring + " " + vbCrLf
bodystring = bodystring + "Thank you for submitting your graphics to privatelabel." + vbCrLf
bodystring = bodystring + "If any additional information is required a representative will contact you." + vbCrLf
bodystring = bodystring + " " + vbCrLf
bodystring = bodystring + "Name: " + Upload.Form ("name") + vbCrLf
bodystring = bodystring + "E-mail: " + Upload.Form ("email") + vbCrLf
bodystring = bodystring + "Distributor: " + Upload.Form ("distributor") + vbCrLf
bodystring = bodystring + "Phone: " + Upload.Form ("phone") + vbCrLf
bodystring = bodystring + "P.O.Number/Job Name: " + Upload.Form ("enter_a_number") + vbCrLf
bodystring = bodystring + "Ship Date: " + Upload.Form ("orderdate") + vbCrLf
bodystring = bodystring + " " + vbCrLf
bodystring = bodystring + "File(s) Submited:" + vbCrLf
bodystring = bodystring + filesmail + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "The following information has been submited to Privatelabel.com." + vbCrLf
bodystringpl = bodystringpl + "Graphics have been uploaded to our server for verification," + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "Name: " + Upload.Form ("name") + vbCrLf
bodystringpl = bodystringpl + "E-mail: " + Upload.Form ("email") + vbCrLf
bodystringpl = bodystringpl + "Distributor: " + Upload.Form ("distributor") + vbCrLf
bodystringpl = bodystringpl + "Phone: " + Upload.Form ("phone") + vbCrLf
bodystringpl = bodystringpl + "P.O.Number/Job Name: " + Upload.Form ("enter_a_number") + vbCrLf
bodystringpl = bodystringpl + "Ship Date: " + Upload.Form ("orderdate") + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "E-proof Requested:" + Upload.Form ("eproof") + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "Printed proof Requested:" + Upload.Form ("pproof") + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "No proof Requested:" + Upload.Form ("noproof") + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "File(s) Submited:" + vbCrLf
bodystringpl = bodystringpl + filesmail + vbCrLf
bodystringpl = bodystringpl + " " + vbCrLf
bodystringpl = bodystringpl + "According to the information provided, the files uploaded have been renamed to include the PO Number provided by the customer." + vbCrLf
Const cdoBasic = 1 'basic (clear-text) authentication
Set objMail = Server.CreateObject("Dundas.Mailer")
objMail.FromAddress = "virtual_sender@abex.com"
objMail.TOs.Add("simon@abex.com")
objMail.TOs.Add("jdewitt@abex.com")
objMail.Subject = "Private Label Graphics Upload"
objMail.Body = bodystringpl
mailres = objMail.SendMail()
set objMail = nothing
Set objMail2 = Server.CreateObject("CDO.Message")
objMail2.From = "virtual_sender@abex.com"
objMail2.To = Upload.Form ("email")
objMail2.Subject = "Private Label Graphics Upload"
objMail2.TextBody = bodystring
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.emailsrvr.com"
'Server port (typically 25)
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
'Your UserID on the SMTP server
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "virtual_sender@abex.com"
'Your password on the SMTP server
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abexvs7101"
'Use SSL for the connection (False or True)
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMail2.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 200
objMail2.Configuration.Fields.Update
objMail2.Send
set objMail2 = nothing
end function
%>
Private Label Graphics Upload

|

|
<%
Dim diagnostics
if Request.ServerVariables("REQUEST_METHOD") <> "POST" then
diagnostics = TestEnvironment()
if diagnostics<>"" then
response.write ""
response.write diagnostics
response.write " After you correct this problem, reload the page."
response.write " "
else
response.write ""
OutputForm()
response.write " "
end if
else
response.write " "
OutputForm()
response.write SaveFiles()
end if
%>
|
|
|
|