Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FSO problem, I think

Posted on 2000-04-17
5
Medium Priority
?
364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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