473,396 Members | 2,081 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,396 software developers and data experts.

no client-side code to check if a file path exists?

<input type="file" size=50"> will produce the browse button
and browse text box.

The user can either select the file from browse button,
or enter a path in browse text box manually. My question is if
there are any client-side code to check if the path exists
in this case? My understanding is that no client-side
solution to this problem.

please advise. thanks!!
Jul 23 '05 #1
3 8625
Matt wrote:
<input type="file" size=50"> will produce the browse button
and browse text box.

The user can either select the file from browse button,
or enter a path in browse text box manually. My question is if
there are any client-side code to check if the path exists
in this case? My understanding is that no client-side
solution to this problem.


Your understanding is correct.

If they type it in the browse box though, and its an invalid path, then
the OS/browser won't allow the browse window to be closed. If they type
it into the file input box though, it won't respond until it attempts to
upload the file. And then, the browser/OS will notify the user. So what
you are trying to do is duplicate functionality that is already built-in
to the browser/OS

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
"Matt" <jr********@hotmail.com> wrote in message
news:ba**************************@posting.google.c om...
<input type="file" size=50"> will produce the browse button
and browse text box.

The user can either select the file from browse button,
or enter a path in browse text box manually. My question is if
there are any client-side code to check if the path exists
in this case? My understanding is that no client-side
solution to this problem.

please advise. thanks!!


This does what (I think) you want but it issues a security warning.

<html>
<head>
<title>typefile.htm</title>
<script type="text/javascript">
function typefile() {
var form = document.forms[0];
var file = form.what.value;
var fold = file.substr(0,file.lastIndexOf("\\"));
window.status = file + " : " + fold;
var oFSO = new ActiveXObject("Scripting.FileSystemObject")
if (!oFSO.FolderExists(fold)) {
alert("Folder does not exist!");
} else if (!oFSO.FileExists(file)) {
alert("File does not exist!");
}
}
</script>
</head>
<body>
<form>
<input type="file" name="what" size=50" onchange="typefile()">
</form>
</body>
</html>
Jul 23 '05 #3
[snip]

Typo!

<input type="file" name="what" size="50" onchange="typefile()">
Jul 23 '05 #4

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

Similar topics

15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
2
by: Raquel | last post by:
How do I know whether the 'runtime client' and the 'application development client' are installed on my machine? When I issue the command "db2licm -l", it gives the following output: Product...
4
by: Yasaswi Pulavarti | last post by:
On an AIX server, I used the db2install script from the command line to install the DB2 UDB 8.1 client. I applied the fix pak 7 to it. Now I need to use the client to test connections to another...
2
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info...
5
by: Paul H | last post by:
How do you folks get a reliable and complete brief of what is required before development starts? I am forever going back to a client once a project has started saying "Hang on, now that I've...
0
by: netgeni59 | last post by:
Hello fellow C# friends, I am trying to write a C# TCP client that was formerly written in Java. The server must still remain in Java. I cannot get text data from the C# client to be received...
0
by: Russ | last post by:
I have set up a C# web application that runs on my test Web Server (Windows 2003 Server, Web Edition). It in turn calls a web service running on the internal network. Now I want to issue a...
2
by: Johan | last post by:
We have run into problems calling a web service from a client running .NET framework 2.0. The problem is that the first call to the web service, after the client has been started, takes very long...
2
by: Frank Swarbrick | last post by:
I am trying to understand "client authentication" works. My environment is DB2/UDB LUW 8.2 on zSeries SLES9 as the database server and DB2 for VSE 7.4 as the client. We currently have DB2/LUW set...
4
MMcCarthy
by: MMcCarthy | last post by:
http://bytes.com/images/howtos/projectscope_blocks.jpgAs a freelance IT consultant for over 10 years, I’ve come to appreciate well defined project scopes. A project scope is a common understanding...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.