Solved

FSO problem, I think

Posted on 2000-04-17
5
358 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now