Welcome Guest, Not a member yet? Register   Sign In
How to remove folder name image in codeigniter 4.3.4
#1

(This post was last modified: 05-18-2023, 07:05 PM by startup.)

PHP Code:
can someone show me how to remove folder name in upload file image in ci 4.3.4
$img 
$this->request->getFile('userfile');
                $img->move(FCPATH '/public/assets/upload/' $img->getName()); 
when i upload image, it create name folder same name image.
for example
abc/abc.jpg

thank you for your helping

note 
we remove FCPATH to move to public folder below:
PHP Code:
$file$this->request->getFile('userfile');
$file->move('public/assets/upload'$newName); 
thank you
Reply
#2

(This post was last modified: 05-19-2023, 12:06 AM by InsiteFX. Edit Reason: spelling error )

Try this.
PHP Code:
$file->move(WRITEPATH 'uploads'$newName);

// should be
$img->move(FCPATH '/public/assets/uploads'$img->getName()); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB