Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,010 members, 7,817,977 topics. Date: Sunday, 05 May 2024 at 01:09 AM

Need Help With Working With Direcories In PHP - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Need Help With Working With Direcories In PHP (970 Views)

A Web Developer Needs Help Working With Bootstrap Carousel / Online Banking Source Code In PHP, MSQL / How Can I Build A Twitter like @mention System In PHP? (2) (3) (4)

(1) (Reply)

Need Help With Working With Direcories In PHP by Setag: 2:45pm On Feb 05, 2016
I created a director handle
$dp = opendir('.'); //old directory
//changed the directory
chdir("./object"wink; //new diretory

i expect the code I write that list files in the new directory but it listed all files in old directory.






Now, if
$dp = opendir("./object"wink;
I write a code that lists all files in this directory it does, but the links don't work well; it thinks my files reside in the old folder











Here's the code:
$dp = opendir("."wink;
chdir("./object"wink;
$currentfile = "";
while ($currentfile !== false) {
$currentfile = readdir($dp);
$filesarray[] = $currentfile;
}
print "<ul>";
foreach ($filesarray as $afile) {
print "<li><a href = \"$afile\">$afile</a></li>";
}
print "</ul>";

(1) (Reply)

Microsoft Buys Linkedin For $26.2B In Cash / Window Mobile / Get Your Approved Adsense Account And Start Making Money.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 5
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.