?
Solved

Delete a file before uploading files

Posted on 2004-07-30
5
Medium Priority
?
458 Views
Last Modified: 2008-01-09
My ISP has provided me with some code to upload files. Which works the first time. The second time I try to upload files it get the following error..

ABCUpload4.XField.4 error '80040050'

A Windows error - The file exists. - (0x00000050) occurred.

/partnersite/regions/EMEA/upload_success.asp, line 24


I talked to my ISP and they say the permissions are set properly. The only thing I've been able to deduce is that the myupload.dat file doesn't like to be overwritten.  How do I delete the file automatically before uploading my other files? Here is the code of the processing asp.

<%
Set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm("filefield")(1).Save "myupload.dat"
%>


Thanks
0
Comment
Question by:kevinbenedict
[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
  • 3
5 Comments
 
LVL 3

Expert Comment

by:dwaldner
ID: 11677217
<%
set fso = Server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(FILEPATH) then
          Set file = fso.GetFile(FILEPATH)
          if fso.FileExists(BACKUP_FILEPATH) then
            Set file2 = fso.GetFile(BACKUP_FILEPATH)
            file2.Delete True
            Set file2 = nothing
          End if
          file.Move BACKUP_FILEPATH
          set file = nothing
end if
set fso = Nothing
...
%>

This should shed a little bit of light on how to do what you want...this moves your file to a backup location....

This will delete the file

<%
set fso = Server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(FILEPATH) then
          Set file = fso.GetFile(FILEPATH)
          file.Delete True
          set file = nothing
end if
%>

but basically, what you want is that fso.FileExists(FilePath) method

Dan
0
 

Author Comment

by:kevinbenedict
ID: 11677549
This is what I tried...

<%
Set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.overwrite=True
theForm("filefield")(1).Save "myupload.dat"
%>

I got the same error.

I'll go look at your link.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 11677921
Maybe you need to use server.MapPath("/myupload.dat")
0
 
LVL 15

Accepted Solution

by:
joeposter649 earned 1000 total points
ID: 11679119
Or a capital O in Overwrite.
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

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 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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

752 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