473,767 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Verify URL/file exists

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 exists.

I'm opening the PDFs with the following: var
Win=open(theLin kURL,"",linkStr ing);

I create theLinkURL dynamically and the file may or may not exist.

Any help would be GREATLY appreciated.
-Amy

May 18 '06 #1
3 7955
akadelski said the following on 5/17/2006 7:58 PM:
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 exists.


Post a form to a hidden IFrame that submits to a server side script that
checks the existence of that file. If it exists, return a page with the
script to attempt to open a new window. If it doesn't exist, return a
page with script to modify the parent page to notify the user that the
file doesn't exist.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 18 '06 #2
Do you have any code samples for this?
All my javascript so far is client side. I'm confused at what the
server-side javascript will look like. I'm muddling through it now.

May 18 '06 #3
akadelski said the following on 5/18/2006 5:59 PM:
Do you have any code samples for this?
Code samples for what?

Please quote what you are replying to.

If you want to post a followup via groups.google.c om, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
All my javascript so far is client side. I'm confused at what the
server-side javascript will look like. I'm muddling through it now.


What server side languages does your web hosting service provide? ASP,
PHP, PERL, what?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 19 '06 #4

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

Similar topics

15
114212
by: Geiregat Jonas | last post by:
is using if(open("file",O_EXCL) != -1){ printf("File does exists")}else{printf("file does not exists"); } a good way of checking if a file exists or not, if not how should I do it ?
18
3182
by: Dan | last post by:
I have code like the following to test for existence of a file. I know the file is there, but File.Exists returns FALSE. The problem appears to be that the file is in a directory beneath "My Documents". When I move it to a directory directly under the root, File.Exists returns TRUE. So I tried using FileIOPermission to give me rights to read it, but still no luck. Any suggestions? Thanks... FileIOPermission f = new...
2
9389
by: Zeno Lee | last post by:
I'm using File.Exists to test a file on my C: drive. My program was strongly named and had caspol -af run on it to allow it to run from the network. There are 3 ways I am doing this: 1) Run from my C: drive, File.Exists works properly and says C:\Temp\test.txt exists 2) Run from my H:\ (network) drive, File.Exists says the file doesn't exist. 3) Run from Visual Studio debugger, with project configuration property
2
14409
by: Chris Fink | last post by:
I am using the System.IO.File class to determine if a file exists on a network share. The File.Exists method keeps returning false, even though the file does exist. The MSDN documentation states, "If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns false regardless of the existence of path."
2
4507
by: MrMike | last post by:
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.
4
2319
by: DEWright_CA | last post by:
I am trying to see if a file exists in a virtual directory, and if so run a method. I try doing File.Exists and the method runs but the file isn't there. Is there a web version of File.Exists or some otherway to get this type of functionality without too much heartache??? Thanks -- D @ premierdata
2
1191
by: iwdu15 | last post by:
hi, how can i check to see if a file exists or not within my application? thanks
3
17309
by: Dan W | last post by:
Hi there. I am parsing a text file and as I parse each line I need to go out to two different directories and check to see if any files beginning with the string I just parsed exist. For example... if the first line in my text file is AS1501 then I need to check Dir1 and see if there are any files that begin with AS1501 then I need to go to Dir2 and check there also. I am trying to check using the following code... If...
4
6592
by: bryanp10 | last post by:
How do I do a client-side check to see that a file exists before attempting to upload it? I am trying to avoid the "Access denied" error I get on form submission if an invalid name is entered in the textbox. This page does it beautifully: http://msconline.maconstate.edu/tutorials/ASPNET2/ASPNET09/aspnet09-11.aspx But how???
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8835
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.