Welcome Guest, Not a member yet? Register   Sign In
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

(This post was last modified: 08-30-2019, 05:03 AM by Henqsan.)

(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




Theme © iAndrew 2016 - Forum software by © MyBB