Solved

FSO problem, I think

Posted on 2000-04-17
5
361 Views
Last Modified: 2008-02-20
I have an upload section, where I give the user a chance to remove the file. I do this with the FileSystemObject, as follows

FilePath = ImageDir & strRecordID & "front.jpg"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(FilePath)
Dim NoPic
NoPic = ImageDir & "NoPic.jpg"
fso.CopyFile NoPic , FilePath , true
Set fso = nothing


It works to delete the file, butit will not copy the blank template file. I get the following error:

Microsoft VBScript runtime error '800a0046'

Permission denied

/OnLineFormsFR/FRDeletePhoto1.asp, line 25

Line 25 was this

fso.CopyFile NoPic , FilePath , true



What gives? I was able to delete the file. Is there different permission to write it?
0
Comment
Question by:MoMarvi
5 Comments
 
LVL 8

Expert Comment

by:xabi
ID: 2725586
Try to change the securty of your web ussing the Microsoft Management console -> Properties -> Directory security -> Anonymous access .. -> edit -> Edit -> Give a user and a password.

xabi
0
 
LVL 3

Accepted Solution

by:
Hencah earned 100 total points
ID: 2725626
Hi,

You can't overwrites a file that has been deleted (that's the main problem). What I look at your code that your deleted file's directory and your Nopic.jpg also from the same directory..If so..Why need to copy??

Try This one: (noPic from other dir)

....
NoPic = OtherImageDir & "NoPic.jpg"
FilePath = ImageDir & "noPic.jpg"
fso.CopyFile NoPic , FilePath , true
....

good luck
0
 
LVL 4

Expert Comment

by:FRehman
ID: 2726163
FilePath = ImageDir & strRecordID & "front.jpg"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(FilePath)
Dim NoPic
NoPic = ImageDir & "NoPic.jpg"
fso.CopyFile NoPic , FilePath , true
Set fso = nothing


I dont understand with your code first you delete the file and after that you copy that file
use that syntex here

if filepath<> "" then
fso.CopyFile NoPic , FilePath , true
end if
0
 
LVL 2

Author Comment

by:MoMarvi
ID: 2729166
Hencah was right, Apparently the FSObject wont let you copy to a recently deleted file.
0
 
LVL 2

Author Comment

by:MoMarvi
ID: 2729170
The thing about FSObject not writing to a recently deleted file, is that documented anywhere?

Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…

828 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