How to display files in a directory?

  • Thread starter =?ISO-8859-1?Q?Ralph_H=F6glund?=
  • Start date
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

I am planning a page that shows music clips that are to be
uploaded into a directory at server level.

I would like to present the files in a list on the html-page so
the user can choose and click on a file to play it. I dont like
to make buttons for each clip if you know what I mean.....

I have partly solved the uploading task but have not found any
good way to present my files except by showing with ftp which I
don't like.

Shall I use some java-script and how?

Ralph in Sweden
 
D

David Dorward

Ralph said:
I am planning a page that shows music clips that are to be
uploaded into a directory at server level.
Shall I use some java-script and how?

JavaScript won't solve the problem. You need a process running on the server
to generate an index page. Most servers will generate directory indexes
automatically (although the feature can be turned off), but rolling your
own in (for instance) Perl will give you more control over the appearance.

The specifics depend on the capabilities of your webserver.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

David Dorward skrev:
Ralph Höglund wrote:




JavaScript won't solve the problem. You need a process running on the server
to generate an index page. Most servers will generate directory indexes
automatically (although the feature can be turned off), but rolling your
own in (for instance) Perl will give you more control over the appearance.

The specifics depend on the capabilities of your webserver.
Thanks. The problem is that the server does not have CGI
possibilities for some reason. So Perl is not an option. In Perl
I could write a program that made buttons, one for each song I
upload, dynamically I think. I remember doing that some years back.
 
G

Greg N.

Ralph said:
I would like to present the files in a list on the html-page...

Make sure you maintain a directoryr on your computer whose contents
match exactly that of corresponding one on your web site.

View that directory on your computer using Firefox or Mozilla.
Click on View/PageSource

Bingo! You now have a list of your directory in HTML format. Save it
under the name index.html and ftp it to your server.

You might want to do a few modifications before you send it, like
changing the title, the colors etc. You may also want make the little
icons for the files accessible on your web site. This also requires
that you adapt the <img> tags that point to these icons.

But this is all optional, the page should work as it is when sent to
your server.
 
O

oeb

Ralph said:
David Dorward skrev:

Thanks. The problem is that the server does not have CGI possibilities
for some reason. So Perl is not an option. In Perl I could write a
program that made buttons, one for each song I upload, dynamically I
think. I remember doing that some years back.

Does your server support PHP?

Javascript is not suitable for this.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

Greg N. skrev:
Make sure you maintain a directoryr on your computer whose contents
match exactly that of corresponding one on your web site.

View that directory on your computer using Firefox or Mozilla.
Click on View/PageSource

Bingo! You now have a list of your directory in HTML format. Save it
under the name index.html and ftp it to your server.

You might want to do a few modifications before you send it, like
changing the title, the colors etc. You may also want make the little
icons for the files accessible on your web site. This also requires
that you adapt the <img> tags that point to these icons.

But this is all optional, the page should work as it is when sent to
your server.
But then I have to do linkages with every line? I want a solution
that I just upload files and after that they are clickable in a list.

Maybe I have to make some PHP-programming for it.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

oeb skrev:
Does your server support PHP?

Yes, it supports PHP 4. I have not made myself into PHP yet so I
don't know where to start. If you have some directions for me I
would very much appreciate that.
Javascript is not suitable for this.

I see.
 
G

Greg N.

Ralph said:
But then I have to do linkages with every line?

What do you mean, you "have to do". It's done, Firefox has created the
links for you.
I want a solution that I just upload files and after that they are clickable in a list.
Maybe I have to make some PHP-programming for it.

Yes, definitely.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

Greg N. skrev:
What do you mean, you "have to do". It's done, Firefox has created the
links for you.

Yes, sorry, your'e right of course. It's just that I have to do
so much work after that.
Yes, definitely.

Just wonder where to start, have not so much knowledge in PHP
yet, so if you have some directions to give me I would be very
happy.. I am good at finding information only I know where to
start... :)

Thanks,

Ralph
 
A

Alan J. Flavell

You need a process running on the server to generate an index page.
Most servers will generate directory indexes automatically (although
the feature can be turned off),

In both senses, yes - the page owner can turn it off to prevent
readers from trawling to see what's in the directory, which can be a
useful thing to do sometimes; and the server admin could turn it off
to prevent the content owner from using the feature, although I can't
imagine that being particularly useful - it's not as if directory
indexing consumes much in the way of resources.
but rolling your own in (for
instance) Perl will give you more control over the appearance.

Agreed, but I'm not sure I'd recommend it casually - there are too
many ways of digging oneself into a fairly deep hole...
The specifics depend on the capabilities of your webserver.

Most servers, in practice, are Apache-based, and Apache can do some
neat things in its directory indexing feature. I would recommend
looking there first. The mod_autoindex documentation should get one
started.

h t h
 
R

Rob McAninch

Most servers, in practice, are Apache-based, and Apache can do
some neat things in its directory indexing feature. I would
recommend looking there first. The mod_autoindex
documentation should get one started.

My example of Apache's autoindex:

http://rock13.com/austin/articles/

The file descriptions have to be entered manually in a .htaccess
file if you want them, but use pattern matching so you don't
necessarily need an entry for every file.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

Greg N. skrev:
A simple google for "php list directory" will give you tons of samples,

Ohh, beleive me, I have googled a quite lot but have not found
the kind of sample that suits me. The issue is also to specify
exact what you're looking for in proper english, it matters a
lot. Therefore I like the people like you that know more in the
searching matters. :)

but you'll still have to learn php anyways, I'm afraid.

Yes, it seems to be similar to any script or C language so that
should not be a problem. It is only the general environment that
must be properly set that I dont know so much about yet. But I
have the general idea.
Thanks a lot, will keep you posted on my progress..

Have a nice day!
 
G

Greg N.

Ralph said:
It is only the general environment that must be
properly set that I dont know so much about yet.

I'm not sure what the problem is, so I'll give you a very simple example:

A html page, let's call it "sample.html", may look like this:

<html><body>
<p>hello world
</body></html>

To get the _same_ output under PHP, you only need to change the file
type to "php". Hence, the file name will be "sample.php". There is
nothing in terms of a special environment that you need, other than a
server that supports PHP.

Now, the example above named "sample.php" works under PHP, but it does
not use any of PHP's language features yet. To use the language, you
have to surround the PHP parts of your code with a pair of special
delimiters: "<?php" and "?>".

<html><body>
<?php
echo '<p>hello world';
?>
</body></html>

You may use any number of PHP code blocks on a page, or you may write
the whole page in PHP:

<?php
echo '<html><body>';
echo '<p>hello world';
echo '</body></html>';
?>

That's all there is to it. Of course, there is more to PHP than just
the ECHO element. Go learn :) .
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

Greg N. skrev:
I'm not sure what the problem is, so I'll give you a very simple example:

A html page, let's call it "sample.html", may look like this:

<html><body>
<p>hello world
</body></html>

To get the _same_ output under PHP, you only need to change the file
type to "php". Hence, the file name will be "sample.php". There is
nothing in terms of a special environment that you need, other than a
server that supports PHP.

Now, the example above named "sample.php" works under PHP, but it does
not use any of PHP's language features yet. To use the language, you
have to surround the PHP parts of your code with a pair of special
delimiters: "<?php" and "?>".

<html><body>
<?php
echo '<p>hello world';
?>
</body></html>

You may use any number of PHP code blocks on a page, or you may write
the whole page in PHP:

<?php
echo '<html><body>';
echo '<p>hello world';
echo '</body></html>';
?>

That's all there is to it. Of course, there is more to PHP than just
the ECHO element. Go learn :) .
Thanks Greg, yes, I have that figured out , I have programmed in
Perl and Javascript and C++ so it should not be any problems. It
is just a matter of finding the right idea how to design the
thing, as always.

This is the homepage so far: http://web.telia.com/~u30325494/

It is not me on the picture, it's a good friend. He is composing
music. Click on Clips, this is what I have done so far just to
get started. It would of course be nicer with a list within the
homepage with a nice design. The songs are not Sponge Music
compositions, just samples from somewere.

The Admin choice is to get to the page with uploading sound clips
to the directory, protected by password. I seemed to get a rather
good security there. Can you get through the password if you try?

Please comment if you like.

Have a nice day, started snowing here :) or :-(

Ralph in Schweden
 
G

Greg N.

Thanks Greg, yes, I have that figured out , I have programmed in Perl
and Javascript and C++ so it should not be any problems. It is just a
matter of finding the right idea how to design the thing, as always.

I still have no idea what your problem really is.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

Greg N. skrev:
I still have no idea what your problem really is.
Well, I try to explain.

Most websites with music clips are presenting clips with a nice
button to click on for playing the clip.

I do not want my friend to go into the webpage and create a new
button everytime he wants to add a clip to his page. He is not a
trained web-designer and do not want to edit webpages. And I do
not want to help him with a new button for every new music-clip.

Therefore I am trying to (one), give him a tool to upload clips
to a directory (JUpload is what I am trying to use), and (two),
supply him an automatic presentation on the website the clips
uploaded for the visitors just to click on. If you saw the popup
with directory listing, that is not what I want really (although
it's simple).

Hope that you got the picture now,

Regards, Ralph
 
G

Greg N.

Ralph said:
I am trying to ... supply him an
automatic presentation on the website the clips uploaded...

Well, that much was clear from the get-go.

You've been told you need to write a server script, maybe in PHP. You've
been told that PHP needs no "general environment that must be properly
set". You have been pointed to a code sample. You said, programming is
no problem for you, but you still have problems "finding the right idea
how to design the thing".

This is is what I don't understand.
 
?

=?ISO-8859-1?Q?Ralph_H=F6glund?=

Greg N. skrev:
Well, that much was clear from the get-go.

You've been told you need to write a server script, maybe in PHP. You've
been told that PHP needs no "general environment that must be properly
set". You have been pointed to a code sample. You said, programming is
no problem for you, but you still have problems "finding the right idea
how to design the thing".

This is is what I don't understand.
OK, I see your point now!

The problem now is completely within myself, how I will program
the thing, that is what I mean by "finding the right idea
how to design the thing", not seeking help anymore, I have got
well enough, thanks a lot. Sorry that I did not understand you
fully...

Have a nice day!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top