![]() |
Uploading a file, moving it, and adding related info - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Uploading a file, moving it, and adding related info (/showthread.php?tid=33092) |
Uploading a file, moving it, and adding related info - El Forum - 08-15-2010 [eluser]aaronr[/eluser] I am wondering if there is some kind of example code out there showing how to upload a file with a description, title, etc. I have a form that is storing information in the database, but I need users to be able to attache a file to the entry in the databse. I would like to be able to renamed the filename to the ID of that entry. Does anyone know of a simple tutorial on how to do that? I see a lot of tutorials show how to upload, but nothing that shows you how to upload and move a file to a filename AND store other information associated with the file. thanks Uploading a file, moving it, and adding related info - El Forum - 08-15-2010 [eluser]Jeremy Gimbel - Conflux Group[/eluser] Have you looked at the File Uploading Class in the user guide? The code there demonstrates how to do a file upload, and the class allows you to specify a filename instead of the original. For additional data, you're going to need to store that in the database. Usually, I just store the filename as a key in the record in the database, so I can easily find the data related to a given file or vice versa. Uploading a file, moving it, and adding related info - El Forum - 08-15-2010 [eluser]mi6crazyheart[/eluser] @aaronr Hope , this will help u : http://www.viewsboard.com/index.php/dboard/viewthread/28/182 Uploading a file, moving it, and adding related info - El Forum - 08-16-2010 [eluser]aaronr[/eluser] [quote author="mi6crazyheart" date="1281946104"]@aaronr Hope , this will help u : http://www.viewsboard.com/index.php/dboard/viewthread/28/182[/quote] @mi6crazyheart, that is EXACTLY what I was looking for. Thank you very much. Uploading a file, moving it, and adding related info - El Forum - 08-16-2010 [eluser]aaronr[/eluser] [quote author="jeremygimbel" date="1281938449"]Have you looked at the File Uploading Class in the user guide? The code there demonstrates how to do a file upload, and the class allows you to specify a filename instead of the original. For additional data, you're going to need to store that in the database. Usually, I just store the filename as a key in the record in the database, so I can easily find the data related to a given file or vice versa.[/quote] Thanks Jeremy, I looked at the File Upload class and it makes sense overall, but I wasn't sure how to combine submitting data to the DB and uploading in the same "page" (or controller). I think the URL that is mentioned below shows me what I need to do. thank you for you time |