Jump to content

earlier uploaded files dont show?!


masterens

Recommended Posts

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

Link to comment
Share on other sites

  • 1 month later...

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"> ';
}

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.