Jump to content

Recommended Posts

Hi everyone, not sure if this is in the right board but im sure its php scripting what I need.

 

A client of mine wants her users to be able to view a list of files uploaded to a certain directory in order for them to download as opposed to uploading them to the server and manually typing links for members to download, s what i need is a web based file browser which automatically pulls all of the files from the directory and lists them for the members to download,

 

Sorry if this makes no sense but I cant find anything anywhere?

Link to comment
https://forums.phpfreaks.com/topic/173079-client-side-server-browser/
Share on other sites

We were working on this earlier today, I believe.

http://www.phpfreaks.com/forums/index.php/topic,267895.0.html

 

I'll assume you can implement that code?

By the way, I don't know what happened in my last post on that thread. I C&P'd, and obviously it messed up my formatting. :(

Sorry im not too fluent with php and so a lot of this is going over my head, ive tried reading up on the glob() function but it doesnt seem to do anything when i implement it, where i have

 

<?php
foreach (glob("*.txt") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
}
?>

 

how do i tell this script to show all files in /members directory?

Thanks for your help  :thumb-up:

would this work?

 

<?php
$dir = "/members";


if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
        }
        closedir($dh);
    }
}
?>

Its just nothing is showing up, Im most probably missing something, but theres files in my members directory and nothing outputting on my page, my current page looks like this...

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>

<meta name="verify-v1" content="JjQqYu4Jx1GcPAbjGwq8XVbkpxptsdhffIC+qnlyFU8=" />

<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>



<META name="description" content="Ann Summers Parties in North West, Runcorn, Widnes and surrounding areas">
<META name="keywords" content="Ann Summers, Parties, Party, manchester, oldham, salford, wigan, stockport, girl night in, hen night">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Anne Summers Anywhere 2009</title>
<!-- InstanceEndEditable -->
<link href="images/style.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>

<div id="browser">

  <div id="wrapper">
    
    <div id="header">
        <img src="images/hdr.png" />    </div>
    
<div id="nav">
        <ul id="tctopnav">	
                    
        <li class="first">
        <a href="index.html">Welcome</a></li>
        
        <li>
        <a href="hostess.html">Become a hostess</a></li>
        
        <li>
        <a href="jointeam.html">Join our team</a></li>
        
        <li>
        <a href="hostessoffers.html">become an organiser</a></li>
                        
        <li>
        <a href="areas.html">areas</a></li>
                            
        <li>
        <a href="about.html">about us</a></li>
                        
        <li>
        <a href="contact.html">contact</a></li>
        
        <li>
        <a href="members/index.html">Members area</a></li>
        
        <li><a href="gallery.html">Gallery</a></li>
        <li class="last"><a href="links.html">links</a></li>
        </ul> 
        <img src="images/JOIN.jpg" alt="d" width="210" height="103" border="0" usemap="#Map2" />
<map name="Map2" id="Map2"><area shape="rect" coords="5,7,205,97" href="jointeam.html" />
</map>

    <img src="images/heart.png" width="171" height="104" border="0" usemap="#Map" />
<map name="Map" id="Map"><area shape="rect" coords="6,6,167,98" href="jointeam.html" />
</map><br />
                  <br />
    </div>
        
        <!-- InstanceBeginEditable name="C ontent" -->
        <div id="content">
        
        
        
        
<?php
foreach (glob("/members/*") as $filename) {
    echo $filename . "<br />";
}
?>
        
        
        
        
        </div>
        <!-- InstanceEndEditable -->
        <div id="footer">
        <a href="index.html">Welcome</a> / <a href="hostess.html">Become a hostess</a> / <a href="team.html">Join our team</a> / <a href="hostessoffers.html">Become an organiser</a> / <a href="areas.html">Areas</a> / <a href="about.html">About us</a> / <a href="contact.html">Contact</a> / <a href="links.html">Links</a><br />
      © 2009 Ann Summers Anywhere | Website design and Development by <a href="http://www.reloaddesign.co.uk" target="_blank">Reload Design</a></div>
    
  </div>

</div>



<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10030192-1");
pageTracker._trackPageview();
} catch(err) {}</script>



</body>
<!-- InstanceEnd --></html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.