Reputation: 535
Well, using HTML5 file handlining api we can read files with the collaboration of inpty type file. What about ready files with pat like /images/myimage.png etc??
Any kind of help is appreciated
Upvotes: 1
Views: 165
Reputation: 4357
Yes, if it is chrome! Play with the filesytem you will be able to do that.
Upvotes: 3
Reputation:
The simple answer is; no. When your HTML/CSS/images/JavaScript
is downloaded to the client's end you are breaking loose of the server.
Simplistic Flowchart
www.mydomain.com/index.html
)www.mydomain.com/index.html
)Explanation
The problem you are facing here is that when HTML is being rendered locally it has no link with the server anymore, thus requesting what /images/
contains file-wise is not logically comparable as it resides on the server.
Work-around
What you can do, but this will neglect the reason of the question, is to make a server-side script in JSP/PHP/ASP/etc. This script will then traverse through the directory you want. In PHP you can do this by using opendir()
(http://php.net/opendir).
With a XHR/AJAX call you could request the PHP page to return the directory listing. Easiest way to do this is by using jQuery's $.post()
function in combination with JSON.
Caution!
You need to keep in mind that if you use the work-around you will store a link to be visible for everyone to see what's in your online directory you request (for example http://www.mydomain.com/my_image_dirlist.php
would then return a stringified list of everything (or less based on certain rules in the server-side script) inside http://www.mydomain.com/images/
.
Notes
Upvotes: 1