Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FSO problem, I think

Posted on 2000-04-17
5
Medium Priority
?
365 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 300 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

782 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