Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 15th, 2007, 01:14 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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



Reply With Quote
  #2 (permalink)  
Old February 15th, 2007, 01:27 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
Reply With Quote
  #3 (permalink)  
Old February 15th, 2007, 01:50 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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

Reply With Quote
  #4 (permalink)  
Old February 20th, 2007, 04:31 PM
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
%>


Reply With Quote
  #5 (permalink)  
Old February 20th, 2007, 04:34 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
Reply With Quote
  #6 (permalink)  
Old February 20th, 2007, 05:49 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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

Reply With Quote
  #7 (permalink)  
Old February 23rd, 2007, 09:53 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #8 (permalink)  
Old February 23rd, 2007, 04:21 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
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




Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:32 AM.


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