Edit Uploaded image and edit the image file name - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Edit Uploaded image and edit the image file name (/showthread.php?tid=61110) |
Edit Uploaded image and edit the image file name - El Forum - 09-20-2014 [eluser]Neoraj3.0[/eluser] Hi I am trying to do a mysql update to the image name (the actually file upload to the folder works fine) but the name does not edit. Here is my code: Model:: Code: function update_project($projectID, $data) Controller:: Code: function editprojectimage($projectID) //edit project page View:: Code: <form class="form-horizontal form-register" enctype="multipart/form-data" action="<?=base_url()?>projects/editprojectimage_pro/<?=$indiv_project['projectid']?>" method="post"> Edit Uploaded image and edit the image file name - El Forum - 09-20-2014 [eluser]InsiteFX[/eluser] Code: $data = $this->upload->data(); If you take a look at the ./system/libraries/upload.php you will see that all the variables are public so you can change the ones you need to. But on a upload everything is stored in a $_FILES[$field] array. Edit Uploaded image and edit the image file name - El Forum - 09-21-2014 [eluser]Neoraj3.0[/eluser] Thanks I saw the file but I am not sure if I need to change anything in upload.php because in my example I am using "file_name" in the controller and placing it into a variable $image_name which should then update the database. Am I missing something? Code: //upload the new image Edit Uploaded image and edit the image file name - El Forum - 09-21-2014 [eluser]Neoraj3.0[/eluser] Ok I figured out my 2 codeigniter noob errors so now it works (minus some good old fashion upload errorchecking): 1) I did not specify the ID so: Code: $this->project->update_project($data); became: Code: $this->project->update_project($projectID, $data); 2) the redirect came to soon on the logic and was messing up the update: Code: redirect(base_url().'projects/allprojects'); |