php website file upload/download

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
php01
Forum Newbie
Posts: 1
Joined: Sat Aug 29, 2009 3:15 am

php website file upload/download

Post by php01 »

I am designing a website where i want to upload pdf & image files and allow users to download the same from the website "download" section. Can anyone suggest how to approach this? What is the coding necessary for upload and download of different file types? thanks.
User avatar
mrvijayakumar
Forum Commoner
Posts: 58
Joined: Tue Aug 18, 2009 12:39 am
Location: Chennai city, India
Contact:

Re: php website file upload/download

Post by mrvijayakumar »

Hello php01,
I written some coding to over come this problem. I hope, it may help full for u. Download the script from below link. And then read this tutorial, to know what i did on code.

Note: Go through the downloaded code and read.

Source code: http://www.splendidwebtech.com/code/dow ... script.zip

What i did is?

1) Connected DB with DB user name and password. Name database as 'download'
2) Design the form with file input box and submit button,
3) If file chosen and press the submit button, It will run set of code.
4) It will check whether file is empty or not, if empty, process will stopped otherwise it will continued with next process.
5) Check for extension, if its image file or PDF document, process will continued otherwise stopped,
6) Move the file from your PC to web server by using move_uploaded_file(). [Note: Check for file upload limit in web server].
7) Store the file name in database. [This used for downloading the file from server].
8 ) Upload process done.
9) Once file uploaded, It will shows as link below upload form for download. [File names will be listed by using MySql query with downloading link]
9) Once user clicked the file name, file will be downloaded from web server.
9) All process completed.

Please send me the feedback. I want to improve my coding standards.
stevejack
Forum Newbie
Posts: 2
Joined: Tue Sep 15, 2009 4:38 am

Re: php website file upload/download

Post by stevejack »

The file is too large and you do not want to have it on your server.You wanted the person to upload a picture and they uploaded something else, like an executable file (.exe).There were problems uploading the file and so you can't keep it.
Post Reply