Re: TidHttp Questions

Giganews Newsgroups
Subject: Re: TidHttp Questions
Posted by:  Remy Lebeau (Indy Team) (
Date: Mon, 14 Aug 2006

"Huhtaman" <nhuh…> wrote in message

> I wrote an ftp client that is used to post various files to my website
> that are then downloaded to my customers computers. I now need
> to write essentially the same functionality using http.

You won't be able to.  HTTP is not designed for that.

> How can I get a hist of files in a specific directory using http ???

Unless the server specifically has that feature enabled (most don't) then
you will not be able to do that.

If the server does have the feature enabled, however, then you can simply
Get() the URL of the directory itself instead of a specific page.  You will
then have to manually parse the HTML that the server generated to contain
the file listing.

> If this is not possible do programmers use a workaround such as
> uploading a text file with the list of files in that directory

That is one way to handle it.  Another is not to use HTTP at all, but to
stay with FTP, which is better designed for everything you are asking.

> How can I rename an existing file in a directory on a website using http

There is no command in the HTTP protocol for that particular operation.  You
would have to delete the file (assuming the server implements/allows the
HTTP DELETE command in the first place), and then re-upload the file using
the new filename.  Otherwise, the only other way (and frankly, the more
common and more likely to be supported way) is to write and upload a
server-side script, written in CGI, Perl, ASP, Java Server Pages, or other
server-side technology, that you can then execute when needed.

> How can I delete an existing file in a directory on a website using http

Unless the server implements/allows the HTTP DELETE command, then you have
to use a server-side script for that as well.

>    Thank you very much. We are using http because ftp gets blocked
> by too many routers

Are you using Active or Passive transfers?  Passive transfers are more
router-friendly than Active transfers.

> some of our vendors are now requiring future communications thru http.

Sounds like maybe they don't know what they are really doing.  HTTP is great
for downloading files, but it is not meant to be used for total file
management, unless you install an actual management system on the
server-side that can be accessed by simple requests.



In response to

TidHttp Questions posted by Huhtaman on Sun, 13 Aug 2006