View Single Post
  #4 (permalink)  
Old February 20th, 2007, 04:31 PM
srsandhu srsandhu is offline
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the coding I am using for replying to an email(Replying to an email is a service in our website) When I try to reply to an email It Gives me
Microsoft VBScript runtime error '800a003a'

File already exists

/messaging/sendmessageprocess.asp, line 12


CODE


<%
SID=Request("SID")
UID=Request("UID")
UserID=Request("UserID")

Dim UserFolder
Dim MailFolder
SET UserFolder=Server.CreateObject("Scripting.FileSyst emObject")
SET MailFolder=Server.CreateObject("Scripting.FileSyst emObject")
IF NOT UserFolder.FolderExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "") THEN
UserFolder.CreateFolder("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "")
    IF NOT MailFolder.FolderExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/") THEN
    MailFolder.CreateFolder("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/")
    END IF
END IF
    IF NOT MailFolder.FolderExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/") THEN
    MailFolder.CreateFolder("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/")
    END IF
SET UserFolder=NOTHING
SET MailFolder=NOTHING

Set Upload = Server.CreateObject("Persits.Upload")
Upload.Save "C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/"
path = "C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/"

Sender=Upload.Form("Sender")
Recipient=Upload.Form("Recipient")

Title=Upload.Form("Title") 'needed to block patterns
Message=Upload.Form("Message") 'needed to block patterns

Response.Cookies("TitleCookie")=Title
Response.Cookies("MessageCookie")=Message

Attach=Upload.Form("Attach") 'detect if photo attachment required - if yes(1) AttachPhoto() else skip

IF Attach=1 THEN
    AttachPhoto()
ELSE
    SendMail()
END IF
'================================================= =======
'------------------ ATTACH PHOTO -----------------------
'================================================= =======
FUNCTION AttachPhoto()
Set File = Upload.Files("ThePhoto")
Hash = File.MD5Hash

'Declare the Photo Name
Set FSO=Server.CreateObject("scripting.filesystemobjec t")
Set FS=FSO.GetFile (path & "/" & File.ExtractFileName)
PhotoName=FS.name

'Begin Individual File Checks
'Size checking
Dim DelPhoto

IF File.Size > 50000 THEN
    SET DelPhoto = Server.CreateObject("Scripting.FileSystemObject")
    IF DelPhoto.FileExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName) THEN
    DelPhoto.DeleteFile("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName)
    END IF
    SET DelPhoto=NOTHING
    AttachError=AttachError & "&AttachError=1"
    Response.Redirect "sendmessage.asp?SID=" & SID & "&UID=" & UID & "&UserID=" & UserID & "&PhotoReport=1#Photo"
END IF

IF File.ImageWidth > 500 THEN
    SET DelPhoto = Server.CreateObject("Scripting.FileSystemObject")
    IF DelPhoto.FileExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName) THEN
    DelPhoto.DeleteFile("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName)
    END IF
    SET DelPhoto=NOTHING
    AttachError=AttachError & "&AttachError=2"
    Response.Redirect "sendmessage.asp?SID=" & SID & "&UID=" & UID & "&UserID=" & UserID & "&PhotoReport=2#Photo"
END IF

IF File.ImageHeight > 500 THEN
    SET DelPhoto = Server.CreateObject("Scripting.FileSystemObject")
    IF DelPhoto.FileExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName) THEN
    DelPhoto.DeleteFile("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName)
    END IF
    SET DelPhoto=NOTHING
    AttachError=AttachError & "&AttachError=3"
    Response.Redirect "sendmessage.asp?SID=" & SID & "&UID=" & UID & "&UserID=" & UserID & "&PhotoReport=3#Photo"
END IF

IF File.ImageType = "UNKNOWN" THEN
    SET DelPhoto = Server.CreateObject("Scripting.FileSystemObject")
    IF DelPhoto.FileExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName) THEN
    DelPhoto.DeleteFile("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphoto s.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "/mail/" & PhotoName)
    END IF
    SET DelPhoto=NOTHING
    AttachError=AttachError & "&AttachError=4"
    Response.Redirect "sendmessage.asp?SID=" & SID & "&UID=" & UID & "&UserID=" & UserID & "&PhotoReport=4#Photo"
END IF

IF AttachError="" OR AttachError=NULL THEN
    'Ok to attach the photo
    SET Conn = Server.CreateObject("ADODB.Connection")
    Conn.open "DSN=xxx; uid=xxx; pwd=xxx"
    msSQL = "Execute sproc_MessagingPhotos_Add '" & UID & "','" & UserID & "','" & PhotoName & "','" & File.ImageWidth & "','" & File.ImageHeight & "'"
    SET ORs = Conn.EXECUTE(msSQL)

    SET ORs = NOTHING
    Conn.close

    'Ok to process the SendMail() function
    SendMail()
END IF

END FUNCTION
'================================================= =======
'------------------- SEND LETTER -----------------------
'================================================= =======
FUNCTION SendMail()
    Dim rx
    SET rx = New RegExp
    rx.Pattern = "\w{35}"
    IF rx.Test(Title) THEN
        Response.Redirect "sendmessage.asp?SID=" & SID & "&UID=" & UID & "&UserID=" & UserID & "&Report=1"
    ELSEIF rx.Test(Message) THEN
        Response.Redirect "sendmessage.asp?SID=" & SID & "&UID=" & UID & "&UserID=" & UserID & "&Report=1"
    ELSE

    Title = Replace(Upload.Form("Title"), chr(34), "&quot;") 'Double Quote Check "
    Title = Replace(Upload.Form("Title"), "'", "#39;") 'Single Quote Check '
    Title = Replace(Upload.Form("Title"), chr(13), "<br>") 'Carriage Return
    Title = Replace(Title, "#", "#35;") '# date marker
    Title = Replace(Upload.Form("Title"), "'", "#39;") 'Single Quote Check '

    Message = Replace(Upload.Form("Message"), chr(34), "&quot;") 'Double Quote Check "
    Message = Replace(Upload.Form("Message"), "'", "#39;") 'Single Quote Check '
    Message = Replace(Upload.Form("Message"), "#", "#35;") '# date marker
    Message = Replace(Upload.Form("Message"), "'", "#39;") 'Single Quote Check '

    Set conn = Server.CreateObject("ADODB.Connection")
    conn.open "DSN=xxx;uid=xxx; pwd=xxx"
    msSQL = "Execute sproc_MessagingSendingMessage '" & SID & "','" & Recipient & "','" & Sender & "','" & Title & "','" & Message & "'"
    Set ORs = Conn.Execute(msSQL)

    Set ORs = Nothing
    conn.close

    Response.Redirect "sendmessage_show.asp?SID=" & SID & "&UID=" & UID
    END IF
END FUNCTION
%>