masterens Posted July 4, 2010 Share Posted July 4, 2010 hi everyone i am currently making my website with an uploadform. The upload function is working, but now i am trying to make the site remember the last 5 uploads. The filenames should appear in an array: $aotf[0] $aotf[1] $aotf[2] $aotf[3] $aotf[4] and since all files that can be/are uploaded are images, i want them to be drawed next to each other, each 128x128. THAT is working, but the fetch for images doesn't. When an image is uploaded, i execute this code: $readhandle=fopen("uploaddb.log","r"); $aotf=fread($handle,filesize("uploaddb.log")); fclose($readhandle); $writehandle=fopen("uploaddb.log","w"); fwrite($writehandle,"$aotf\r\n" . "uploadform/gebruikers/" . $naam); fclose($writehandle); then,there is some html code, and then there is this code: $aotf=explode("/n",$aotf); for($i = count($aotf) - 5; $i <= count($aotf); $i++) { echo ' <img src="'. $aotf[$i] . '" width="128" height="128"> '; } when i open the page, all img src's are empty. The writing works, and the folder of the image is 7777 chmod and the images draw on the screen, but not as the last uploaded. Does anyone know how to make this work? maybe even without a fwrite? Thank you, masterens EDIT: i cannot use mysql Quote Link to comment Share on other sites More sharing options...
masterens Posted August 17, 2010 Author Share Posted August 17, 2010 working! if anyone wants to know: page load: $readhandle=fopen("uploaddb.log","r"); $aotf=fread($readhandle,filesize("uploaddb.log")); fclose($readhandle); upload succesful: $writehandle=fopen("uploaddb.log","w"); fwrite($writehandle,"$aotf\r\n" . "uploadform/gebruikers/" . $naam); fclose($writehandle); loading last uploads: $aotf=explode("\r\n",$aotf); for($i = count($aotf) - 5; $i <= count($aotf); $i++) { echo ' <img src="'. $aotf[$i-1] . '" width="128" height="128"> '; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.