Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2007, 01:14 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default File Already exists Error

Hello

Does anybody know how to fix
Microsoft VBScript runtime error '800a003a'

File already exists

/messaging/sendmessageprocess.asp, line 12



 
Old February 15th, 2007, 01:27 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Thanks for moving to the correct forum but you are not being any more clear then in your Original Post (http://p2p.wrox.com/topic.asp?TOPIC_ID=56301). That error literally means that a file you are trying to create already exists, my guess is that you have not told the FSO object that it can overwrite the file if it already exists.




================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 15th, 2007, 01:50 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks dparsons, i will try o give FSO the permission to overwrite the file.
Thanks

 
Old February 20th, 2007, 04:31 PM
Registered User
 
Join Date: Feb 2007
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
%>


 
Old February 20th, 2007, 04:34 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Show me everything up to line 12.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 20th, 2007, 05:49 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Here is everything upto line 12
<%
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

 
Old February 23rd, 2007, 09:53 AM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does anybody know any solution to this problem?
Thanks in advance

 
Old February 23rd, 2007, 04:21 PM
Authorized User
 
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

instead of:
Code:
IF NOT UserFolder.FolderExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphotos.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "") THEN
UserFolder.CreateFolder("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphotos.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "")
try something along these lines:
Code:
if UserFolder.FolderExists("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphotos.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "")=false then
UserFolder.CreateFolder("C:\Program Files\Ensim\WEBppliance\SiteData\Domains\userphotos.primallink.com\ROOT\Inetpub\wwwroot/" & UserID & "")
else
'do nothing
end if









Similar Threads
Thread Thread Starter Forum Replies Last Post
document() - check if a file exists N.Todd XSLT 2 September 19th, 2007 05:50 AM
Check if a file exists on network darrenb Access VBA 2 March 27th, 2007 07:15 PM
File already exists srsandhu ASP.NET 1.0 and 1.1 Basics 1 February 14th, 2007 08:43 PM
Determining if a Remote File Exists hugh@kmcnetwork.com VB How-To 1 January 5th, 2007 11:56 PM
check first to see if the file exists crmpicco Classic ASP Professional 2 December 1st, 2005 12:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.