Solved

FSO problem, I think

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CREATE DATABASE 3 45
Help with Classic ASP - Parameterizing Query 16 66
Post from Jquery mobile form goes wrong in classic asp action page 2 37
Add Rows on a Table 8 54
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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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