Chris Val Kef Posted December 12, 2006 Share Posted December 12, 2006 i have files stored in a folder and i want user can download them. Mime-type and file-size have to be stored in database when i upload the file or it doesn't matter? are there any simple code examples with files for download or something? I want to return an icon for different type of files (ie the icon of Acrobat for .pdf) it's the first time i'm handling files so any help would be very very useful! Quote Link to comment Share on other sites More sharing options...
SharkBait Posted December 12, 2006 Share Posted December 12, 2006 Usually what I do is when I upload the file I will strip it's extension to see what type of file it is. Yes its not entirely accurate but since I am the only using the script I know a .PDF will be a PDF ;)When displaying the files I would use a [code=php:0]switch()[/code] statement to determine what icon I would show for the file type.Database wise I store as much as I can about the file. Filesize, Filetype, Filename, uploaded time etc. I learnt that you have to make sure your filesize is corrent when you have a download script get the file and offer it to the client downloading it. Setting up the file's header prior to downloading will corrupt the file. Quote Link to comment Share on other sites More sharing options...
Chris Val Kef Posted December 12, 2006 Author Share Posted December 12, 2006 thanx for the reply! 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.