Jump to content

Retrieve certain files from server


bassguru

Recommended Posts

Hello everyone,

 

I have an application that allows users to save images to the server. The code below demonstrates this:

 

				//Give image file a unique name (username+(unix)time.extension)
			$image_name=$username.''.time().'.'.$extension;

			//Define directory where image will be stored
			$newname="images/".$image_name;

			//Upload the image to the server
...

 

As you can see, the image name is changed so it is uniquely defined. The username of the person is used as well as the unix epoch time (in seconds) to make sure of this.

 

What I now want to do is search the folder on the server for certain images that belong to the logged in user. For example, 'user01' logs on, so all the images with the file names beginning with 'user01' are displayed (the unix time is not required; it is purely there to uniquely identify each file).

 

The problem is I have no idea what PHP function lets the application select files, let alone the ones beginning with a predefined username! Any advice or code is welcome.

 

Many thanks in advance

bassguru

Link to comment
https://forums.phpfreaks.com/topic/173462-retrieve-certain-files-from-server/
Share on other sites

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.