• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send image to other method

#1
I get the finished data from a form via POST in one method and want to pass the image to another method for file upload. How should I pass $ _FILES ['my_image'] from one method to another?
Reply

#2
$_FILES['my_image'] is not the image itself, it's an associative array containing information about the uploaded file.
It looks something like this:
[name] => image.jpg
[type] => image/jpeg
[tmp_name] => /tmp/php3zX7t5
[error] => 0
[size] => 25974
Reply

#3
(08-29-2019, 08:33 PM)adamoli Wrote: $_FILES['my_image'] is not the image itself, it's an associative array containing information about the uploaded file.
It looks something like this:
[name] => image.jpg
[type] => image/jpeg
[tmp_name] => /tmp/php3zX7t5
[error] => 0
[size] => 25974


Yes, it is a array. But I'm assigning this array to a variable and sending it to another method of the same class. Then I pass this variable to the CodeIgniter upload class $this->upload->do_upload($my_image['tmp_name']), but returns an error saying no images were uploaded!
Reply

#4
That's because the upload is looking for the image to be in a folder.

You should save the image to a folder then upload it from there.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.