Jump to content

File uploading and listing


fatmart

Recommended Posts

Hi. I searched over the internet and I found some scripts about uploading files with php. It stores the files in a folder and all. But what I want to do is actually have a list on the upload.php page (where my upload script is) of all the files I have uploaded in my folder. I want to be able to download them after too.

 

Do you have any scripts to propose me or a link to a page that can explain me how to do it?

 

Thanks and sorry for my english, it isn't my main language

Link to comment
https://forums.phpfreaks.com/topic/88246-file-uploading-and-listing/
Share on other sites

Here's a little code I used to use. It should list all the files inside your directory. Hope it helps.

 

<?php
if($handle = opendir('dirctory/')) //EDIT TO YOUR DIRECTORY
{
	while(false !== ($file = readdir($handle))) 
	{
		if(($file == ".") || ($file == "..")){}else
		{ 
				$files .= "<tr> <td> $file </td> </tr>\n";
		}
	}
	closedir($handle);
}

echo "<table>
		$files
	</table>";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.