CodeIgniter Forums
Image Upload without Upload Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Image Upload without Upload Class (/thread-59403.html)



Image Upload without Upload Class - El Forum - 10-01-2013

[eluser]Unknown[/eluser]
Hello,

i'm trying to upload pictures to a third party service (cloudinary). I included the API sucessfully and now want to upload pictures from a form.

With cloudinary it works like this:

Code:
\Cloudinary\Uploader::upload($_FILES["file"]["tmp_name"]);


So what i need is the $_FILES["file"]["tmp_name"]. But my Form doesnt give it to me.

Form:
Code:
<form method="post" accept-charset="utf-8" acti site_url('/send_item'); ?" enctype="multipart/form-data"/>
      <div class="form-group">
        &lt;input type="file" name="file"&gt;
      </div>
      <button type="submit" class="btn btn-primary btn-large">Send!</button>
    &lt;/form&gt;

How to get the tmp_name?

var_dump($_FILES['file']); just gives me the name, no tmp_name (controller)

and

$this->input->post('file') just gives me the name, too. (controller)

So the Cloudinary Upload fails.

What can i do?


*EDIT*
If i use enctype="multipart/form-data" in my Form, $this->input->post('file') returns NULL. If not, it returns the name of the uploaded file?!


Image Upload without Upload Class - El Forum - 10-01-2013

[eluser]AlexandrosG[/eluser]
Are you sure you don't have any typo mistake that cancels the enctype property? Check again!

What is this
Code:
acti site_url('/send_item');
that i see?

As far as i know, you can't get information about posted files through $this->input->post() . This method reads data from the $_POST, and the information you want is in $_FILES. You have to use $_FILES!


Image Upload without Upload Class - El Forum - 10-01-2013

[eluser]Unknown[/eluser]
Thank you for your reply.

acti site_url('/send_item'); this is just killt by the forums [ code] [/ code] style

The problem was probably no upload rights (CHMOD). I'm using direct browser upload via jQuery now and it works!