473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Verify File Exists

This is a tough one, but here goes.

I have a webform textbox where users input a filepath. For example:
\\servername\sharename\file.xls. Is there anyway that I could use VB code to
verify that the filepath and filename are valid after the user has input
them? Basically this would serve to quality check whether or not the user
has input the correct file path.

Thanks.
Nov 19 '05 #1
2 4487
bool System.IO.File.Exists( string file )

returns true or false if the file exists. The file parameter can be a UNC
path, but you have to ensure you have read permissions to the directory.

if System.IO.File.Exists( txtInput.Text ) = true Then
'the file exists
else
'the file does not exist
end if

bill

"MrMike" <Mr****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
This is a tough one, but here goes.

I have a webform textbox where users input a filepath. For example:
\\servername\sharename\file.xls. Is there anyway that I could use VB code to verify that the filepath and filename are valid after the user has input
them? Basically this would serve to quality check whether or not the user
has input the correct file path.

Thanks.

Nov 19 '05 #2
Perfect! Thank you William!!!

"William F. Robertson, Jr." wrote:
bool System.IO.File.Exists( string file )

returns true or false if the file exists. The file parameter can be a UNC
path, but you have to ensure you have read permissions to the directory.

if System.IO.File.Exists( txtInput.Text ) = true Then
'the file exists
else
'the file does not exist
end if

bill

"MrMike" <Mr****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
This is a tough one, but here goes.

I have a webform textbox where users input a filepath. For example:
\\servername\sharename\file.xls. Is there anyway that I could use VB code

to
verify that the filepath and filename are valid after the user has input
them? Basically this would serve to quality check whether or not the user
has input the correct file path.

Thanks.


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan Williams | last post by:
Apologies for the cross-post but i thought i'd aim for the largest audience possible. I have a web site that users have to register to with their email address. The site then emails the user...
10
by: bsandell | last post by:
I need to write a stored procedure to verify that a table exists and also that the user executing the stored procedure has access to the specified table. Any user can call this publicly...
9
by: Jonny | last post by:
Hi, Please could you tell me what the quickest way would be to verify that a line of text exists in a file. I would like to be able to do something like: grep "^line of text$" filename.txt...
2
by: Wayne Wengert | last post by:
I want to write a Windows application to go through all the email addresses in an SQL Server table and to report which ones are invalid. From Googling and perusing NGs it is my understanding that...
3
by: akadelski | last post by:
I need a way to verify a file exists before I attempt to open it. Right now we are storing PDFs server-side and I need a way to either 1. Check if the physical file exists or 2. check if the URL...
0
by: jpr | last post by:
Hello, I need some help. I have a form named MASTER based on a table also called MASTER. A control of my form in names SSN which stores the client SSN. On the same form I have placed a subform...
2
by: SM | last post by:
Hello, I've created this 'wonderful' function the embeds a youtube video in a specified div section using the Javascript DOM. Everything works OK... until I realize how bad the logical programming...
2
by: donnyf | last post by:
Hi guys. I've put together a website ( http://worldwidemediaproject.com ) that is a database of internet streaming tv/radio stations from around the world. I have built the site with all users in...
7
by: =?Utf-8?B?Tmlrb2xheSBQb2Rrb2x6aW4=?= | last post by:
Good afternoon, community! How you help me? I need to know, how could I verify e-mail address? I don't mean ( for example: test@test.com it is valid or not) I wanna know is that real world...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.