----- Original Message -----
From: "Soláne G Diego"
Hi,
May I know, how can I generalize my php script and how would that script
be like based on these description and also the flow chart:
1--The script should be a ONE php-program that takes a file name (URL) to
download as command line parameter.
2--Depending on the extension of the file to download, the program should
choose between downloading and unpacking (.ext1 extension), or just
downloading (.ext2 and .ext3).
<snip>
------------------------------
Hello Soláne G Diego,
This sounds very much like an assignment.
If it is then we can give you general pointers - if it is NOT then please
say so and we can give code.
You didn't mention how it would be determined if "the file exists in the
directory it should exist in".
Also you mentioned "command line". Command line is totally different to a
browser web page. I presume you mean URL query string.
Some more questions -
Check to see if file exists - where
1) A remote server
2) The local servers file path
3) The local servers http streams
4) The local PC
Download file - where to
1) the local servers file path
2) the local PC
If zipped then unzip - where to
1) the local servers file path
2) the local PC
Please write two separate scenarios for zipped and not zipped
Thanks.
PS: Forced downloads are problematic especially with Internet Explorer.
There is plenty of example code for this on the header() function page at
php.net