04-25-2012, 12:42 AM
Ok i have a folder i use to upload images among other things.
Now i want a script to allow me and a select few others to view the contents and click on the file name to load the image or whatever.
I have that working largely however i cant seem to get it to link to the file.
Now im not going to post the vb hooks as there is no need however the below is the code i am using to sort the folder and display its contents.
Its doing that ok. Displaying based on time stamp however i cant get the linking to work properly. I get the link with an array at the end.
Here is the code for anyone that can help.
Also if you see other issues please let me know.
Me and coding dont go well together.
Im more of a porn man
Thanks if anyone can help.
Fixed it. I was calling up the timestamp instead of the file for the link reference lol.
Man im useless at this.
Now i want a script to allow me and a select few others to view the contents and click on the file name to load the image or whatever.
I have that working largely however i cant seem to get it to link to the file.
Now im not going to post the vb hooks as there is no need however the below is the code i am using to sort the folder and display its contents.
Its doing that ok. Displaying based on time stamp however i cant get the linking to work properly. I get the link with an array at the end.
Here is the code for anyone that can help.
Also if you see other issues please let me know.
Me and coding dont go well together.
Im more of a porn man
PHP Code:
<?php
$path = $_SERVER[DOCUMENT_ROOT]."XXXXXXXXXXXX";
$dh = @opendir($path);
while (false !== ($file=readdir($dh)))
{
if (substr($file,0,1)!=".")
$files[]=array(filemtime($path.$file),$file);
}
closedir($dh);
if ($files)
{
rsort($files); #sorts by filemtime
foreach ($files as $file)
echo"<a href=http://www.MY URL HERE/$file>$file[1]</a><br>\n"; #file[0]=Unix timestamp; file[1]=filename
}
?>
Thanks if anyone can help.
Fixed it. I was calling up the timestamp instead of the file for the link reference lol.
Man im useless at this.