GSoC/GCI Archive
Google Code-in 2011 FreeBSD

Implement FreeBSD community portal (FCP6) - file upload from WWW

completed by: n00l3

mentors: Wojciech A. Koszek, Jakub Klama

Description of a task

This is a research task. It may or may not be deployed in production systems. No effort has been made to coordinate this task with the FreeBSD Core Team.

In order to accomplish this task you must implement a PHP script with a form asking a user for a file to upload. Once the user clicks 'Upload', file is send to the server and (1) filename of the file is stored in the SQL database (2) SHA1 checksum of the contents of the file is calculated (3) the file is stored to the file name which is equal to the SHA1 value. SQL table can be very simple - FILE_ID, FILENAME, SHA1_CHECKSUM

Example:

You have 'freebsd.txt' text file which has 'FreeBSD' in it. Once the user uploads the 'freebsd.txt' file, SHA1 is calculated and the result is '5ca5c2e9f3fd4fae8db2f481cc2ae65c649c4365'; file is saved to '5ca5c2e9f3fd4fae8db2f481cc2ae65c649c4365.db' file, and values(1, 'freebsd.txt', 5ca5c2e9f3fd4fae8db2f481cc2ae65c649c4365.db) land in the SQL table.

Uploaded files should be kept in 'db' directory. So the full path to the file saved should be 'db/5ca5c2e9f3fd4fae8db2f481cc2ae65c649c4365.db'.

Please follow Steve's Krug "Don't make me think" principles as well as Jacob Nielsen's useability rules when designing the WWW form. In other words: make it as minimalistic and simple as possible.

Technology choice is up to you, but PHP is preferred (Facebook API is in PHP at least). No framework is required to accomplish the task; however, frameworks aren't prohibited. In case of not using any framework, please follow the MVC design principles.