/    Sign up×
Community /Pin to ProfileBookmark

PHP list of folder with links problem D:

Hello,
I have a script that I found out in the internet and I tried alot of thinks but I cant find what’s wrong.
The script does a list of what’s in a folder and then it makes links to that files but it links them wrong, it should link them to admin/upload/FILE
and it just links them to href=”FILE”

[code=php]

<html>
<head>
<title>ObritSesam</title>
</head>
<center>
<?php
if ($handle = opendir(‘admin/upload/’)) {
while (false !== ($file = readdir($handle)))
{
if ($file != “.” && $file != “..”)
{
$thelist .= ‘<a href=”‘.$file.'” target=”_blank”>’.$file.'</a><br>’;
}
}
closedir($handle);
}
?>
<P>Llista de archius:</p>
<P><?=$thelist?></p>
</center>
</html>

[/code]

Thanks in advance! ?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@TheDegree0authorSep 19.2012 — I correct myself here:

"I have a script that I found out in the internet and I tried alot of thinks but I cant find what's wrong."

to:

I have a script that I found out in the internet and I tried alot of different things but I cant find what's wrong.

Sorry for my bad english! D:
Copy linkTweet thisAlerts:
@TheDegree0authorSep 19.2012 — I correct myself here:

"I have a script that I found out in the internet and I tried alot of thinks but I cant find what's wrong."

to:

I have a script that I found out on the internet and I tried alot of different things but I cant find what's wrong.

Sorry for my bad english! D:
Copy linkTweet thisAlerts:
@NogDogSep 19.2012 — Just add the directory:
[code=php]
$thelist .= '<a href="admin/upload/'.$file.'" target="_blank">'.$file.'</a><br>';
[/code]
Copy linkTweet thisAlerts:
@TheDegree0authorSep 19.2012 — Just add the directory:
[code=php]
$thelist .= '<a href="admin/upload/'.$file.'" target="_blank">'.$file.'</a><br>';
[/code]
[/QUOTE]


Thank you!

1 question, where should I put the target="_blank" here?
[code=php]
print("<TR><TD><a href="admin/upload/$dirArray[$index]">$dirArray[$index]</a></td>");
[/code]
Copy linkTweet thisAlerts:
@TheDegree0authorSep 19.2012 — Nvm! found myself how ?

[code=php]
echo '<TR><TD><a href="admin/upload/'.$dirArray[$index].'" target="_blank">'.$dirArray[$index].'</a></td>';
[/code]
×

Success!

Help @TheDegree0 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...