Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Displaying Folder Contents


I am trying to display the contents of a folder for users to view/download, what is best way to do this? Also, is there a way to "hide" specific files in that folder that I do not want displayed?




View Complete Forum Thread with Replies

Related Forum Messages:
Getting And Using Contents In A Folder
I want to make a photogallery/slideshow with PHP...

The 'gallery/slideshow' would show up inside a new window.
basically, I just want links with possibility to go:

- forward
- back
- to the very beginning
- to the very end
- away (close the window)

Can I use PHP to determine the contents of the folder with the pictures and then use variables to determine which photo to show, and what URL's should be generates for the arrows? So each folder with a series of photographs would have one PHP file and the pictures themselves in them (it's not a problem to rename them).

Should be simple enough, but I'm just starting out with PHP, and I'd like to have something working as soon as possible... the website I'm working on is about to launch soon (my first 'commercial' web project :) ), and this is about the only thing left that I still have to sort out how to do...

View Replies !
Getting Contents Of Folder
I've made half of the code for a little "hosting" site for a few of the members of my site. Their files are uploaded to /login/<username>/

I'm now stuck as to how to show the contents of the folder in a page. I think the use of fopen() is needed, however the php website is a little confusing.

View Replies !
Contents Of A Folder
I want to put the contents of a folder into an array. Say a folder called data has index.php and text.txt in it. Now I code $files=get_contents_of_folder('data'), and that makes this: $files[0]='index.php' and $files='text.txt'.

View Replies !
Delete Folder And Its Contents
is there any way of deleteing a folder and all of its contents using PHP?

View Replies !
Deleting Folder And Contents With PHP
Im using this code to delete a folder using my script but it says Directory not empty. What code could i use that will delete the folder, subfolders, and all its contents.

$currentdir = getcwd();
$directory="$currentdir/users/$_COOKIE[username]/albums/$_GET[albumname]";
rmdir($directory);

View Replies !
Folder Contents Function?
I'm looking for a function that puts the contents of a folder (the file names) into an array. Is there such a beast? For instance, if there is a folder off of my root called /tips/, and I want to list the files that are in it, such as tip1.txt, tip2.txt, etc.

View Replies !
Remove Folder Contents
Does anyone know how to detect a folders contents with  PHP and delete all files within?

View Replies !
Show Folder Contents
Is there a function that will show the contents of a folder in the browser? EX:

parent category
file1
file2
file3
etc....

View Replies !
Zipping Up A Folder And Its Contents?
I installed the zip extension for PHP 5.2, but reading the documentation, I can't figure out how to zip up an existing folder.  I mean, I have this folder with a bunch of files in it, right?  I *could* scan the whole thing and add each file to a newly created zip archive, but I don't want to.

Is there any way to tell PHP to zip up a folder and have its contents be everything inside that folder?

View Replies !
Empty Folder Contents
i have a cache folder called "static" i cant figure out how to create a code to clear the contents of the folder Code:

View Replies !
Copy Entire Contents Of A Folder To Another
Situation:

I am creating a folder based on input from a form and then creating an images folder underneath that -- that works great and I can read and write to the newly created folders AS LONG AS IT IS ONE FILE AT A TIME!!!

What I would like to do:

I would like to copy the contents of an entire folder over to one of the newly created folders ALL AT ONCE -- or in a loop -- which is what I am trying to do but keep getting denied.

My code as it is now:
if ($handle = opendir("$sourcedir")) {
echo "Directory handle: $handle<br><br>";
echo "Files:<br><br>";
while (false !== ($files = readdir($handle))) {
if ($files != "." && $files != "..") {
if (!copy($files, $imagepath)) {
echo "failed to copy $files into $imagepath<br><br>";
}
}
}
closedir($handle);
}

all of the variables are working fine... it goes through the loop just fine -- I know this because it prints out the error for every file in the folder... it just won't copy the files over to the new folder while in this loop.

Here is the beginning of the error messages:
Directory handle: Resource id #2
Files:
failed to copy step_c1.gif into /htdocs/www/schemes/adfasa/images
failed to copy step_b1.gif into /htdocs/www/schemes/adfasa/images
failed to copy step_a1.gif into /htdocs/www/schemes/adfasa/images

by the way: adfasa is the folder name brought in by the form and images is the folder I create underneath it.

Is this something that is possible to do in a loop? If so, what is wrong with this one. If not, how is something like this done?

Of course since I know the files that are in the folder I want to copy from I could just go ahead and copy them ONE by ONE but that doesn't seem to be very efficient.

View Replies !
Syncronizer - Synchornize Folder Contents
is there anyway to sync to folders Contents between two Computers in PHP...

View Replies !
Create A Zip File Of The Contents Of A Folder?
Im wondering if there is a way, through a php script, to create a zip file of the contents of a folder?

E.g. the web user would submit a form, and after a bit of validation, a zip file would be created, and a download forced.

How could would i go about creating the zip file through php?  (Im hosted on a Windows mashine)

View Replies !
Is There Anyway Of Deleteing A Folder And Deleting All Of Its Contents With It?
is there anyway of deleteing a folder and deleting all of its contents with it?
i know that with rm_dir needs to folder to be emptied

View Replies !
Delete Entire Folder Contents
What is the best way of deleting an entire folders contents in php I looked at this, but not sure exactly how to implement. http://uk.php.net/manual/en/function.unlink.php

I dont want to get involved with something that could mash my system if I get it wrong.

View Replies !
Displaying Directory Contents.
Is it possible to display the contents of a directory onto a page with php? Is there a certain function for it?

View Replies !
Displaying Contents Of Txt Files
Is there a way, using php, to pull the content of all txt files in a directory and display it along with the file name?

View Replies !
Displaying Contents Of A Text File?
I'm trying grab the content of a text file and print it a web page. I believe that I should be using something along the lines of "file" or "fopen", but I'm not having any luck. Any thoughts or tips?

View Replies !
Reading A Directory And Displaying Its Contents As An URL
I am starting to play with php and i got a webfolder where i get regulary new files. I'm looking for a command that reads out a directory and then displays the url that would be required to download the file. Code:

View Replies !
Displaying A Files Contents...But Limited?
<?php
$file = "news.txt";
if (!$file_handle = fopen($file,"r")) { echo "Cannot open file."; }
if (!$file_contents = fread($file_handle, filesize($file))) { echo "Cannot retrieve file contents."; }
else {
$filedone = ftruncate($file_contents,50);
echo "$filedone"; }
fclose($file_handle);
?>

but what i want to do is only display about 60 characters .... i have read that i need to use the ftranuce function but have had no luck implementing it... any ideas

View Replies !
Displaying All Pics In A Folder
I would like to write a script that displays all photos (jpg) from a folder.  I want to be able to load photos into a folder without renaming them and have a script sort them and display them alphabetically.

View Replies !
Displaying Image From Folder
I want to list all the image file in an array from a directory and then display them such that they appear say, 6 images per page. Can some1 please give me the code to do this.

View Replies !
Displaying Files In A Folder Using A Calender
I have excel sheets generated daily and weekly in this format for filenames..for daily sheets the filename is Jan-10-2002 (mmm-dd-yyyy) and weekly Week-39-2002. I have a script that uploads to a constant folder all the excel sheets.

Is there a script that can display the daily scripts in form of a calender. I.E a user can choose to view or download the sheet by choosing the date? Also another for displaying weekly excel sheets in a weekly format.

View Replies !
Problem With Displaying Folders From Folder
I want to display all the folders present from 1 folder, it works fine and gives me . and .. as directory listing which is not good. The code is as follows:

$path = "../cuz";
$img = opendir($path);
while($file = readdir($img))
{
if(is_dir($file))
{
echo "Folder name is ". $file;
}
}
closedir($img);

View Replies !
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

View Replies !
Read Contents Of An External XML Page And Then Parse Its Contents
I have a URL that generates an XML page. I'm trying to read its contents and parse the information. But, I keep receiving these error messages: Code:

View Replies !
Merge The Contents Of One Array Into The Contents Of Another.
There are many times when I need to merge the contents of one array into the contents of another. Below is how I make this happen now. Do you know of a better or quicker way to do this? The main reason I am concerned is that the arrays I'm merging now have 40,000+ items in each array. I want to streamline the process if possible.

$arrayA = array('item0', 'item1','item2');
$arrayB = array('item3', 'item4', 'item5');

for($i=0;$i<count($arrayB);$i++) {
     $arrayA[] = $arrayB[$i];
}

print_r($arrayA);

View Replies !
Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

View Replies !
Creates A Temporary Folder And A File Within The Folder.
I have a PHP script which creates a temporary folder and a file within the folder.

I have a problem when trying to remove the file and folder using my FTP program. The ownership and group are set to NOBODY. I cannot change the permissions on either the file or the folder.

I have tried chmod and chgrp and chown but for some reason I cannot change permissions.

View Replies !
Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea
how to do this, while I can do other php without a problem. Once I
know how to go about it I'll be okay.
It's two things I think?
1. see if there's a trailing slash and delete it.
2. Remove the preceding path to /x, the folders and slashes, and
delete them.
and then I have x.

X by the way is the final folder in a website and this grabs it for
me.

<?
$name = $REQUEST_URI;
?>

View Replies !
Get /folder/ To Redirect To /folder/index.php ?
I have a link www.example.com/folder/ but when people visit this i want it to go to www.example.com/folder/index.php because then it will log the page visit. Any ideas using mod rewrite i can get /folder/ to redirect to /folder/index.php ?

View Replies !
File In Folder Above Root Folder
I have a .php script in a folder one level above my website root, and I'd like to include it in pages in various website subfolders, some below the root. Can I use ($_SERVER['DOCUMENT_ROOT'] in the path in some way.

View Replies !
Help With Displaying Selecting A Date Range And Displaying Results
I wish to create a simple form that allows the selection of a start date and a stop date with the ability to select what columns to be displayed in the result page.

View Replies !
Same Contents
i have an array that i have created by exploding a string that is comma seperated

(for example my string was 1,2,3,4,5,6,7,8,9 and now i have this as array[0] = 1 etc etc)

What i am wondering, is if my string was more like 1,2,3,5,6,7,1,1,1,8,9,3,3,2,2 could i search the array and find what appears most frequently in the values (in the above case 1)? So if 1 has 4 occurences, then i echo this value first,then 3 which has 3 occurrences (etc etc)

I am trying to make a basic tagging system for my website,and i want the tags that appear most to be displayed first or in a bigger font or something.

View Replies !
Contents Through Php
i think declered it self as a zip archive. now in the php script it wrote files and generated the zip file for download. He did this when i had this php file genberate a txt file and then after the user clicked on download theyed click on delet file link and it would delet the file. But with that script it never really wrote or deleted anything. It was just generated for that one dl.

View Replies !
File Get Contents()
I need to verify, (working on the HTML section of a mailer), If in my php.ini: allow_url_fopen is On Will file_get_contents(file URL) called as follow:

$mailer->Body = str_replace('{MEMBER_NAME}', $member_name, file_get_content($htmlBody) );

Allows the file to become my email body? where $htmlBody comes from the DB...

View Replies !
Add The Contents Of 2 Texbox's
I have designed a form that will display a price (22.34) in
a text box, and another price in the other text box... I also have a blank
text box... Now I want to add both the prices together and get a total in
the bloank textbox..
I got this example off a website sumwhere.. But it does not display the
decimal number, it only displays the whole number

var number1 = parseInt(document.forms[0].CasesSellingPrice.value);
var number2 = parseInt(document.forms[0].AccessoriesSellingPrice.value);
document.forms[0].total.value = number1 + number2;



View Replies !
Getting Address Bar Contents With PHP
How do I get the contents of the browser address bar with PHP - assuming it
is possible?

In javascript it is done with: unescape(window.location.pathname), but is
there a php equivalent?

View Replies !
Refresh The Contents?
I have a php page containing a dynamically generated list. Once the list is displayed the list only refreshes when you select refresh in the browser, how can i get it to refresh the contents?

View Replies !
List Db Contents
can someone help me make a script that will list the information in one colum in my table! See each clan I have has an ID, and CEO and bla bla bla! But what I want done is it to only show the name of the clan in A dropdown menu. So that when users are signing up they can select the clan they want and it well ya you know puts the name beside theres in the table. But can someone make me a script to list all the clans Names and only names not ID, Ceos, and all that other stuff. Code:

View Replies !
Getting The Contents Of A File.
Is it possible to get the contents of a file; display the contents in a textbox; and edit the contents of that file. Then click a button and change the contents to the new updated file.

The reason I want to know this is because I have programmers on my site and I don't want them to have access to the FTP or cPanel. They will jus enter the name of the file, click submit, be able to edt and replace that file. All without FTP or cPanel.

View Replies !
Display Contents In Mb/gb
i was wondering if it was possible using php to display how much in mb or gb how many files in  afolder e.g

folder <-- containg 1,000mb of data

View Replies !
File Put Contents
looking to write to a file with out overwriting the previous data?  is there a way to turn overwrite off with the file put contents?? im trying to keep a log of form data.

View Replies !
File Get Contents
i am trying the example of get_file_contents but i get the following error.

what i want to do is get all the web page of google but the code wont work any ideas please cheers.

Warning: file_get_contents() expects at most 2 parameters, 5 given in

<?php
$content=file_get_contents("http://www.google.com",FALSE,NULL,0,20);
echo $content;
?>

View Replies !
Load The Contents
I want to be able to load the contents of a text file into a couple different form fields. So like title and body would be two different input fields. The script would somehow seperate the title and the body in the text file so it can be redistributed to each input field when I go to edit it. then be able to change it and then hit the submit button to overwrite the old contents with the new contents.

View Replies !
Getting File Contents
I am trying to get the contents of a txt file and add a number to it and then store the sum of that equation in the file Code:

View Replies !
Emailing Contents
I need php code that will allow me to email the contents of a form to an address. If searched the internets but am new to php and dont know where to put parts or what to do. I also have just a javascript thing to check if values are entered into the text boxes before it allows the submit button to be pressed. Someone please help.

I need to know how to email the contents of textboxes in a form as well as keeping my javascript alerts so that all boxes are filled.

View Replies !
Contents Of Php File
am having a problem with require/include parsing .php files. It works fine for html, but for some reason when I include .php files, the page displays my actual php code as plain text. Yet it also seems to execute said code after displaying it.

View Replies !
Get Contents Between Two Markers
I am trying to build a web based php editor for myself to make editing pages easy. Most of the various bits and pieces I can easily include, by including varibles into text input fields. Just one problem remains, how to edit PHP in it? What I thought of doing was to use something like strpos of two different tags;

ob_start();
require_once("index.php");
$buffer = ob_get_contents();
ob_end_clean();

$pos1 = strpos($buffer, "//extra php here");
$pos2 = strpos($buffer, "//end extra php");

However this does not seem to work - maybe it is because there are spaces in the string - but how can I get the positions of these two markers in the $buffer - or is there a better way of doing this? I would also need something to get rid of everything at the beginning up until the marker, and everything after the 2nd marker. The only thing I have thought of, is to perhaps create another file to contine the extra PHP code in - but why increase used disk space, whilst also possibly letting the users see source code.

View Replies !
Send The Contents
I have a form on my website that uses arrays. Basically I can't figure out how to send the contents of those arrays in the body of an e-mail using the mail() function. If I try just putting the name of the array like $array it will just send the text "Array" to my mailbox, which is normal. Unfortunately, the usual means of displaying the contents of an array such as "while (list($key,$value) = each($array)" won't work in the mail function. is it possible to send the contents of my arrays in the body of an e-mail and if so how do you do it?

View Replies !
Contents Into Html
Does anyone knows how to convert word document into html?

View Replies !
Getting The Contents Of A Website
Can someone point me in the right direction of how to get the contents of a website and display it on my own web page.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved