![]() |
Uploading File to Database - 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 File to Database (/showthread.php?tid=40475) |
Uploading File to Database - El Forum - 04-09-2011 [eluser]anthrotech[/eluser] Hello All, I am having problems properly uploading a file to a table in a MySQL database. Similar code outside of CI works fine. Here is my code for uploading the file in CI. members.php - controller file Code: // Validate Form input and check Image Parameters Data is uploaded to the Database, but photo does not show up. I have also tried changing $content to (string) $content AND "$content" AND '$content'. I note that are differences in the File data uploaded between CI and regular PHP5. CI - File Data Column �PNG\0\0\0IHDR\0\0\0�\0\0\0�\0\0\0f&\0\0yiCCPICC Profile\0\0x��gT���{r\"� Custom PHP5 - File Data Column �PNGIHDR Uploading File to Database - El Forum - 04-17-2011 [eluser]anthrotech[/eluser] No one have ideas? Seems like a common problem. Do I need to provide more details? Uploading File to Database - El Forum - 04-17-2011 [eluser]Wondering Coder[/eluser] why don't you try the CI class upload. That's what I used in my apps. Uploading File to Database - El Forum - 04-18-2011 [eluser]Atharva[/eluser] Why you want to upload file to database? You can simply upload it on file system and just store the Name of the file in any db column. Uploading File to Database - El Forum - 04-18-2011 [eluser]danmontgomery[/eluser] Need more information. Can you post the code where you're saving the file, and where you're displaying the file? If you're using AR, it will automatically escape queries for you... Since you're escaping, it might be happening twice. That'd be the first place I'd look. |