![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| ....that will automatically create a download link for every file (and folder, if possible) in a particular directory. The contents of the directory will be changing frequently and I don't want to have to manually update the download page. Is such a thing possible? Thanks! Jay | |||
|
| Advertisements |
| | #2 | ||
| <?php if ($handle = opendir('.')) { while ($file=readdir($handle)) { if ($file != "." && $file != "..") { echo "<a href='$file'>$file</a><br>\n"; } } closedir($handle); } else { echo "Error Processing this stuff!"; } ?> "Jay Vance" <jay@mtboard.com> wrote in message news:bf1pl3$a14f4$1@ID-190190.news.uni-berlin.de... > ...that will automatically create a download link for every file (and > folder, if possible) in a particular directory. The contents of the > directory will be changing frequently and I don't want to have to manually > update the download page. Is such a thing possible? Thanks! > > Jay > > | |||
|
| | #3 | ||
| I'm really, really new at this, so please forgive my ignorance. Where do I put this code? Thanks again! Jay "spearman" <net@news.com> wrote in message news:J3_Qa.59866$sY2.28252@rwcrnsc51.ops.asp.att.n et... > <?php > > if ($handle = opendir('.')) > > { > > while ($file=readdir($handle)) > > { > > if ($file != "." && $file != "..") > > { > > echo "<a href='$file'>$file</a><br>\n"; > > } > > } > > closedir($handle); > > } > > else > > { > > echo "Error Processing this stuff!"; > > } > > ?> > > "Jay Vance" <jay@mtboard.com> wrote in message > news:bf1pl3$a14f4$1@ID-190190.news.uni-berlin.de... > > ...that will automatically create a download link for every file (and > > folder, if possible) in a particular directory. The contents of the > > directory will be changing frequently and I don't want to have to manually > > update the download page. Is such a thing possible? Thanks! > > > > Jay > > > > > > | |||
|
| | #4 | ||
| You put it at the location in the page you want the links to be displayed. "Jay Vance" <jay@mtboard.com> wrote in message news:bf1qtq$a4bv7$1@ID-190190.news.uni-berlin.de... > I'm really, really new at this, so please forgive my ignorance. Where do I > put this code? Thanks again! > > Jay > > "spearman" <net@news.com> wrote in message > news:J3_Qa.59866$sY2.28252@rwcrnsc51.ops.asp.att.n et... > > <?php > > > > if ($handle = opendir('.')) > > > > { > > > > while ($file=readdir($handle)) > > > > { > > > > if ($file != "." && $file != "..") > > > > { > > > > echo "<a href='$file'>$file</a><br>\n"; > > > > } > > > > } > > > > closedir($handle); > > > > } > > > > else > > > > { > > > > echo "Error Processing this stuff!"; > > > > } > > > > ?> > > > > "Jay Vance" <jay@mtboard.com> wrote in message > > news:bf1pl3$a14f4$1@ID-190190.news.uni-berlin.de... > > > ...that will automatically create a download link for every file (and > > > folder, if possible) in a particular directory. The contents of the > > > directory will be changing frequently and I don't want to have to > manually > > > update the download page. Is such a thing possible? Thanks! > > > > > > Jay > > > > > > > > > > > > | |||
|
| | #5 | ||
| Thanks! Jay "Matt Montgomery" <NOSPAMmatt@NOSPAMchums.com> wrote in message news:9Q_Qa.98$s01.106097@news.uswest.net... > You put it at the location in the page you want the links to be displayed. > > "Jay Vance" <jay@mtboard.com> wrote in message > news:bf1qtq$a4bv7$1@ID-190190.news.uni-berlin.de... > > I'm really, really new at this, so please forgive my ignorance. Where do > I > > put this code? Thanks again! > > > > Jay > > > > "spearman" <net@news.com> wrote in message > > news:J3_Qa.59866$sY2.28252@rwcrnsc51.ops.asp.att.n et... > > > <?php > > > > > > if ($handle = opendir('.')) > > > > > > { > > > > > > while ($file=readdir($handle)) > > > > > > { > > > > > > if ($file != "." && $file != "..") > > > > > > { > > > > > > echo "<a href='$file'>$file</a><br>\n"; > > > > > > } > > > > > > } > > > > > > closedir($handle); > > > > > > } > > > > > > else > > > > > > { > > > > > > echo "Error Processing this stuff!"; > > > > > > } > > > > > > ?> > > > > > > "Jay Vance" <jay@mtboard.com> wrote in message > > > news:bf1pl3$a14f4$1@ID-190190.news.uni-berlin.de... > > > > ...that will automatically create a download link for every file (and > > > > folder, if possible) in a particular directory. The contents of the > > > > directory will be changing frequently and I don't want to have to > > manually > > > > update the download page. Is such a thing possible? Thanks! > > > > > > > > Jay > > > > > > > > > > > > > > > > > > > > | |||
|
| | #6 | ||
| OK, I have a little PHP script that I think will do what I need it to do, but I want to run the script with some HTML "window dressing". I seem to recall reading down below that I can't call PHP from within HTML, so I guess I need to call HTML from within the PHP script. How do I do that? I'm trying to do it with "include" but can't seem to get the syntax right, not sure where to use the "include" statement to call the HTML file. Here's what I have: <?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "index.php") { echo "<a href=$file>$file</a>\n <br>"; } } closedir($handle); } ?> I want to call an HTML file called "download.html". Where do I put it? Jay "Jay Vance" <jay@mtboard.com> wrote in message news:bf1pl3$a14f4$1@ID-190190.news.uni-berlin.de... > ...that will automatically create a download link for every file (and > folder, if possible) in a particular directory. The contents of the > directory will be changing frequently and I don't want to have to manually > update the download page. Is such a thing possible? Thanks! > > Jay > > | |||
|
| | #7 | ||
| "Jay Vance" <jay@mtboard.com> wrote in message news:bf21qf$a2c0f$1@ID-190190.news.uni-berlin.de... > OK, I see what it does, lists all the files in the directory with a > hyperlink. The only problem is that when I click on a link the browser > actually opens the file instead of downloading it. As you can see, I'm > really ignorant about this. What do I need to do to have the link download > the file instead of opening it? Zip them up. Then all files will download. ![]() > Jay > > > > "Bad Man" <heyho@letsgo.com> wrote in message > news:Xns93B9B7D8BECBFsonicyouth@206.127.4.10... > > On 15 Jul 2003, "Jay Vance" <jay@mtboard.com> impressively belched the > > following: > > > > if you just paste that code into a page on its own you will see what it > > does. note that the '.' in the opendir() statement means that it is > > reading files from the current directory. you could always use opendir > > ('images/') or any other directory name. > > > > > > > > > I'm really, really new at this, so please forgive my ignorance. Where > > > do I put this code? Thanks again! > > > > > > Jay > > > > > > "spearman" <net@news.com> wrote in message > > > news:J3_Qa.59866$sY2.28252@rwcrnsc51.ops.asp.att.n et... > > >> <?php > > >> > > >> if ($handle = opendir('.')) > > >> > > >> { > > >> > > >> while ($file=readdir($handle)) > > >> > > >> { > > >> > > >> if ($file != "." && $file != "..") > > >> > > >> { > > >> > > >> echo "<a href='$file'>$file</a><br>\n"; > > >> > > >> } > > >> > > >> } > > >> > > >> closedir($handle); > > >> > > >> } > > >> > > >> else > > >> > > >> { > > >> > > >> echo "Error Processing this stuff!"; > > >> > > >> } > > >> > > >> ?> > > > > | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: download, file, generate, html, page |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I pass data to an HTML page so that it can edit it? | Tom Thackrey | PHP | 1 | 07-01-2007 3:37 PM |
| How to pass data to HTML page without cookies? | Robert Oschler | PHP | 1 | 07-01-2007 3:37 PM |
| Where does PHP embedded in an HTML page execute? | rush | PHP | 0 | 07-01-2007 3:37 PM |
| embedded php in html file, how to tell calling html file? | MeNotHome | PHP | 1 | 07-01-2007 3:17 PM |
| page with no .html | olwen | HTML | 6 | 07-01-2007 1:57 PM |
| Featured Websites | ||||
|