Link to home
Start Free TrialLog in
Avatar of Member_2_5069294
Member_2_5069294

asked on

How would I list files via HTTP?

I'm working on an application that shows images (amongst doing many other things).  The target audience is developers working as a team across a network.  I'd like to offer them the ability to work via the internet.  The program would show a list of their Bookmarks/Favourites, they click on one of these and the program would display the compatible files available via HTTP from that site.  I've already done something similar with FTP.  The target platform is Windows.

After reading through the HTTP specification I can't find a way to do this.  I don't see a way to get a list of files of a particular type (something like GET *.jpg).  There are options in the request header for matching but these appear to define wether the resource is transfered or not, something like requesting 'get bricks.jpg if its a jpg'.

Am I misunderstanding the options in the header?  I can't find any example of this being done or how the results would be returned.
Avatar of tetrasodium
tetrasodium

I don't think http itself allows getting an index of only certain types of files.  It's fairly simple to restrict the types of files you want in the directory listing, but that would be for every request rather than whatever the user is looking for.  The best way would probably be to stick a little php/asp/perl script in the directory that will grab the filtered contents of the directory and spit it out in a format you like using a simple GET request to define the filtering.
Avatar of Member_2_5069294

ASKER

I suspected that.  I was hoping someone who knew the protocol better than me would prove me wrong.  The script idea would be a nice solution, except it seems unlikely that the program will have write access to the server.

When you say "It's fairly simple to restrict the types of files you want in the directory listing" does that mean there is a way to list the files in a directory via HTTP?  That would be a decent solution, I can easily do the filtering myself if I could only get some filenames.
ASKER CERTIFIED SOLUTION
Avatar of tetrasodium
tetrasodium

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
While this isn't the answer I was hoping for, I think it's the best answer it's possible to give.  The answer is clear and addresses the question effectively.  Thanks.
I tried this on a few sites that I thought people might use to serve data.  The results were inconsistent as far as index pages go.  However, I think anyone serious about working this way might set up a private server.

Parsing IMG tags out of HTML appears to be the best answer available (possibly the only one).  At least something is likely to show whether they set up an index page or not.  If I'm parsing the HTML, I could get the links and show them in the same way as FTP folders.  If they point to an image (as in the example above) I can just show that.