Page 1 of 1

Advice for creating form?

Posted: Fri May 22, 2009 8:42 am
by bmblack
I'm kind of new to php. I've looked all over the internet for a tutorial that could get me started working in the direction I need to go but haven't had much success.

I need to create a form.

Here's what the form needs to have/do:

1. This form will be used to upload files (typically pdf or ppt).
2. The file needs to be uploaded to a specific folder on the server based on what "category" the user selects from a drop down menu in the form.
3. The form needs to have a few fields that the user would fill in describing the file being uploaded. Ex: name, description
4. Each "category" as mentioned in #2 will have it's own page on my website. Upon submission of the form, the respective "category" page needs to update and display information submitted and display a link to the file uploaded.

The basic idea is to allow people around the office to upload files to their respective department pages through a nice, easy web interface - then have that information actually display on our website for any users to see.

I'm sure there isnt' a tutorial anywhere that does EXACTLY what I want, but any advice on how I could approach this would be very much appreciated.

Re: Advice for creating form?

Posted: Fri May 22, 2009 9:09 am
by jayshields
Start off by creating a HTML form which accepts files. Then create a PHP script which handles the uploading of files. There are plenty of tutorials for this bit.

Next you have to decide how you're going to store your meta-data (the file descriptions). A few options:
- You could create a text file for each image and store the description in there.
- You could use a flat-file RDBMS like SQLite.
- You could use a proper RDBMS like MySQL.

In terms of simplicity, text files are the way to go - but that isn't an extensible solution and could get very messy if you've got a lot of files. The other side of the coin is using an RDBMS like MySQL - maximum extensibility but the most difficult (still not difficult at all though - we can help and there's loads on the net).

If you don't want file descriptions this is a very simple system. I assume you've got pre-defined categories (users can't create new ones) - although that wouldn't add much complexity anyway.

Start off by attempting the HTML form and considering your data storage options.