Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Tamas Dukai
Tamas Dukai
6,103 Points

Generating URL to uploaded file

Hi,

I have a form on my website where users can submit various info and upload a text file with each submission. After each submission the items are echoed out in a table. The uploaded text files are stored on my server, the rest of the data are stored in the database.

So each uploaded file has a title, belongs to a category and has other attributes. On the front-end, in the table each submission is listed in a <tr>.

I can retrieve information from the database and list them in my table, but I can't figure out how to add a download link to the text files.

I was thinking that upon submission the script should rename the text file and generate a link to it, and store the link in the database. Then I could retrieve that link and display it in the table on the front end. I'm just not sure if this is the most efficient way and how to start. Any idea?

Thanks