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
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>";
?>

Link to comment
Share on other sites

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.