[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Use Jquery or AJAX to check if a file exists

Posted on 2013-05-15
5
Medium Priority
?
1,210 Views
Last Modified: 2013-07-08
How could I use jQuery or AJAX to check if there are:
1) a pdf
2) and an mp4
files in a folder?
I know the file names, if that is useful.

thanks in advance
0
Comment
Question by:badwolfff
[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
5 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39169055
You would have to have a program on the server that you contact that can check to see if the files are there.  You can't check anything on the user's local machine.
0
 

Author Comment

by:badwolfff
ID: 39169216
At present the site is on localhost
and once it works I will transfer it to a server.
Can it be done?
0
 

Author Comment

by:badwolfff
ID: 39169217
And if so, how?
thanks again for replying
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39169425
Of course it can be done on the server.  The scripting is trivial in any commonly used server side scripting language.

Cd&
0
 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 1000 total points
ID: 39169535
As has already been said, you need a program/script sat server-side - something like PHP or ASP. You will then code your javascript to call that file, which in turn will read the folder and check for the files and spit out some kind of result - TRUE / FALSE etc. which is returned to your Javascript.

PHP has a function called file_exists() - returns a BOOLEAN value,  so your script mught be as simple as:

<?php echo file_exists('somefile.mp4'); ?>

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

650 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