Sunday, September 16

My REAL first hands-on experience on PHP.....

Well it all began on Sep 13, 2007. I was asked to solve the following problem statement for Pragyan '08 CSG inductions...(and i was busy packing my bag to leave for my home later that nite)

Make an upload form in php with the following conditions :

1) All files to be uploaded in a single folder
2) The file names on the server must be in the serial order 000001, 000002, 000003, .....
3) The actual names of the files must be saved in database
4) There must be a maximum limit to the file size that can be uploaded that is : 4 MB.
5) Only files that must be allowed to be uploaded are : pdf, jpg, png, gif, doc, txt
(case insensitive)

Then, make another page which shows the names of all the files that have been uploaded
1) The file names must be links
2) On clicking the link, the file coming up for download must be the actual file with the
original file name


I was taken aback ! Oh my GOD...i didnt even know any basics of PHP.
On my way to my house... the problem statement kept on lingering in my mind. I decided it to take it up seriously atleast this time (lol).. PHP was an unexplored territory to me!
The first thing i did after reaching home was .... GUESS WHAT ??
....
....
I booted my comp (it was about 6 am on Sep 14)
Searched the net for some basic PHP tutorial and what do you know... PHP was indeed easy!

Thanks to PHP.net and several other sites, i was able to solve it atlast by about that afternoon. Here is the zipped version of the solution ...
Download PHP file uploader