# Need suggestions in file transfer using http & html



## deh (Sep 6, 2002)

Hi,
I am using html to program my pages. 

I want to be able to show contents of files in a directory to be available for download.

So I provided a link to web/ftp/filesfordownload (this is an example).

I then found out that my web provider requires index.html in the directory or it won't show.
Long story short i have no choice but to stick with this provider and they only provide 1 FTP account which is the admin account, and obviously i don't want everyone to have this account info.
Is there any way i can program the index.html page to show the rest of the files in that directory and make them available for download.

So within web\ftp\download
i have index.html (which i must use)
and then i might have various word documents within this folder as well.

I realize i can program index.htm to point to each file but the contents of the folder will vary and i don't want to have to program the web page each time i upload a new file. I just want to show whatever contents are available for download in that file at any time.

Thanks.


----------



## Squashman (Apr 4, 2003)

Is the web server running Apache or IIS?


----------



## deh (Sep 6, 2002)

Hi running Apache.

Its wierd though initially when i inquired about the type of server it told me Apache and that if index.html or any of the other defaults is not mentioned it will show the contents which is what i want. I made sure proper rights were assigned chmod 777 but i still get a "Dont have access to access this page".

So I went to email the provider. I then get a few suggestions before the email is sent.

And under the heading Why do i see "Forbidden You do not have permission to access" i get this explanation:
The main reason is that you do not have a valid index page in the directory you are trying to view.
........
The server has a list of valid index page filename's and if the server cannot find one it will display forbidden message.

Just to see if this was true i dropped an index.html file in the directory and then tried to access the link again and lo and behold i accessed it fine.

So it kind of seems like there are conflicting statements. Number 1 says if i don't have index.html it will show the contents (which i want) but #2 says i will get a Forbidden if i don't have an index.html.

any thoughts would be appreciated.

Thanks.


----------



## AKA Arizona (Jul 22, 2003)

Simple, create a link to your download page call your download page whatever.html or htm. On the whaterver.html page create links to the programs you want for download similar to this http://www.akaarizona.com/tools.html


----------



## deh (Sep 6, 2002)

Hi thanks,
The problem is that the files will be changing and i don't want to have to program links everytime a file is uploaded available for download.
For example, today in the directory there may be files called a.doc, b.doc and c.doc available for download. Yes i could create a link (href) pointing to these downloads and code it right on my page (index.html) HOWEVER tomorrow there may be files called d.doc, e.doc and f.doc. The code pointing to a.doc b.doc and c.doc would not "point" to the new files.

I basically want somehow that if someone pulls up index.html it will show whatever contents are in that directory without having to hard code all the time.


----------



## Dreambringer (Jan 19, 2005)

Easy  create a directory... and DO NOT put an index.html this will just show the contents of the folder..

What an index does it show the contents of the folder, so if you dont have one it shows everything..

Like here.


----------



## deh (Sep 6, 2002)

Hi,
Thanks. When i try to not include the index.html i get the error "Forbidden, you do not have permission to access". Initially i thought not including index.html would list the contents as well but i get the Forbidden error.
So when i went to email my provide i got the information i posted above about there needing to be an index.html.

I gave the folder i created full access priveleges. I just have a feeling its some wierd policy of my provider as I only am allowed 1 ftp account and that is the administrator account which is to allow me to upload webpages and do maintenance.


----------



## Dreambringer (Jan 19, 2005)

Ohh you need to CHMOD the folder... to allow people to view it..

CHMOD the folder to 755 which allows users to view the folder.

You can use SmartFTP.com if you have access to the FTP site someone else may have anothe way to change the CHMOD.

Here are some screen shots and basic info on what I am talking about.

http://www.zachjorgensen.net/za/chmodtutor.html

If the folder is allready CHMOD to 755 or 777 then I am sorry, I will have to dig a bit deeper.


----------



## deh (Sep 6, 2002)

Hi yes i did, same results(see my post #3).

Thanks for the suggestions. If you have any more suggestions would appreciate.


----------



## Dreambringer (Jan 19, 2005)

ok so let me make sure I understand.

You have talked to the proivder, and they said "you have to have an index.html" and when we are talking about the proivder we are talking about the host correct?

You have CHMOD the folder? What is it set to?

Is the folder in another folder? ie. www.yoursite.com/folder/directory


----------



## deh (Sep 6, 2002)

Yes, well i went to email the host. Initially did a search on their Knowledgebase to find out type of server. It said Apache and then even explained to me that if i didn't include that if i didn't include index.html that it would list entire contents of folder which is what i want. 
But when i try to access it mysite.com/ftp/showthisdir (example) i get the "Forbidden...." message. I ensured i was using the correct path and double checked the rights. The CHMOS is now set to 777 which is the most lenient. Initially i tried at 755 but that didn't work either.

So i went to email the host about my problem. After i submitted email it must've searched my email for keywords and came up with an automated list of possible causes and that is when i read the apparently conflicting article about it needing index.html. It says that the hosts server will pull up the first valid index.html file in the directory if none is specifiec but if it cannot find one it will display the Forbidden message.
So just for the heck of it i stuck an index.html file in the directory and then again tried to access mysite.com/ftp/showthisdir . Low and behold i didn't get the Forbidden message it pulled up the index.html file.
So i am beginning to think it is some wacky setting on their end. That is why i was hoping there would be someway to code the index.html file to show the contents as some kind of workaround.


----------



## Dreambringer (Jan 19, 2005)

I see, so use'n your exapmple of mysite.com/ftp/showthisdir, have you tried to change the CHMOD of the ftp dir?

and I am looking into the code'n of the HTML file..


----------



## deh (Sep 6, 2002)

Yes, i made sure parent folders had proper rights. I did find it odd that i can pull up mysite.com/ftp/showthisdir/index.html file when i only put in mysite.com/ftp/showthisdir so it is reverting to index.html but its not showing dir contents as i want it to. THus why i am suspecting it is some wierd policy on hosts end. Unfortunately to make a long story short i am stuck with this host for awhile.

If you could find anyway i can work around by coding what seems to be the required index.html it would be great. I was messing around with redirecting a link to the root. Something like http:// but that doesn't work.

thanks again for the help.


----------



## Dreambringer (Jan 19, 2005)

Ok I am sorry, but I cannot answer this one  from what I was looking at, is the only way you can is with an ASP file, and I do not know much about ASP.

But I will continue to research it


----------



## deh (Sep 6, 2002)

Thanks, if i find any info from the Host i'll post just for any future reference.


----------



## Dreambringer (Jan 19, 2005)

Not a bad idea.. but I do not think it will work.. but the code would be

ShowthisDir

But I will continue to work on this one


----------



## deh (Sep 6, 2002)

Dreambringer said:


> Not a bad idea.. but I do not think it will work.. but the code would be
> 
> ShowthisDir
> 
> But I will continue to work on this one



No it didn't and when i try to refer back to just the directory i http://www.mysite.com/ftp/showthisdir I get the Forbidden message again. I tried that as well though.

I was hoping to trick it with the http:// code but didn't work.


----------



## Dreambringer (Jan 19, 2005)

Ok, I am at work right now, so I am not able to test this out, but read thru this and give it a whirl and let me know if this works...

http://www.avdf.com/aug96/art_html.html


----------



## Squashman (Apr 4, 2003)

Hopefully your website provider allows you to have .htaccess files. Create a file named .htaccess and put this in it.

Options +Indexes

The file must be named .htaccess with no other file extension and the period in front of it.


----------



## Squashman (Apr 4, 2003)

There are also some simple CGI scripts you can run to do this as well. I did that for some reason in the past and I can't remember why. It was rather easy to setup.


----------



## Dreambringer (Jan 19, 2005)

Yeah the link I found was a cgi script.. but was not able to test it  I hate work


----------



## deh (Sep 6, 2002)

Squashman said:


> Hopefully your website provider allows you to have .htaccess files. Create a file named .htaccess and put this in it.
> 
> Options +Indexes
> 
> The file must be named .htaccess with no other file extension and the period in front of it.


That was it! 
Thanks for the help.

And dreambringer you didn't research for nothing i am going to check out your link. 

thanks again.


----------



## Dreambringer (Jan 19, 2005)

great  and now I know thats all you need.

What is .htaccess?


----------



## Squashman (Apr 4, 2003)

Dreambringer said:


> great  and now I know thats all you need.
> 
> What is .htaccess?


Well you could read the techno mumbo jumbo on the Apache Web Site or you can read this link. I refer people to it alot.

http://www.javascriptkit.com/howto/htaccess.shtml


----------

