0

Hello, Good evening!

I am trying to validate my atachments in my system. In my program, there is an upload button, what I am trying to do is to validate it by not copying and saving the upload file once it already exists in the database.....

HERE IS MY CODE:

If System.I.O.Exists(FileToCopy)=True Then
    System.I.O.File.Copy(FileTo Copy, NewCopy)

Else
    MsgBox("File already exist")

but it is not working, any file uploaded eventhough it is not yet existing in the database is not saving...

.....Hope you could help me in this dilemma...

2
Contributors
3
Replies
16
Views
4 Years
Discussion Span
Last Post by Reverend Jim
0

I think you want

If System.IO.File.Exists(FileToCopy) Then
    MsgBox("File already exists")
Else
    System.IO.File.Copy(FileToCopy, NewCopy)
End If
0

i tried that code as well but it does not save as well. tHE Message "File already exist" always show up whenever I upload may it be existing or not.......

Edited by akasekaihime: wrong spelling

0

My mistake. It was very early in the morning here. Try

If System.IO.File.Exists(NewCopy) Then
    MsgBox("File already exists")
Else
    System.IO.File.Copy(FileToCopy, NewCopy)
End If

Edited by Reverend Jim

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.