CodeIgniter: you did not select a file to upload

I tried to upload some files using CodeIgniter, but at first: nothing happened, but the file does’nt seem do upload. I tried it by using

$this->upload->do_upload();

and then i tried to debug it by using

echo $this->upload->display_errors();

in the line where the conditional differs which is error or not. And i got this message: “you did not select a file to upload”.

And actually, it’s a simple solution to deal with this problem. i just change $this->upload->do_upload() to $this->upload->do_upload(“field_name”). where “field_name” is the name of the form we submitted by html. Aaand voila! It worked just fine.

One more thing, just in case you want to know, that i tried to make sure the file that i upload will overwrite the old one. In this case, i just put line $config(“overwrite => TRUE”), or you use array for this $config, just put the “overwrite => TRUE” thing alongside. It worked for me. Cheers.

2 thoughts on “CodeIgniter: you did not select a file to upload

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s