• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to integrate upload file with my form


I'm new to CI and I would like to integrate in an existing form, the upload file.
Before that I've tested the upload from the documentation and it works,
now I've downloaded a complete example form and it works well, so I'm trying to integrate the upload without success, could you help me ?

Here is the controller : https://docs.google.com/document/d/1JtQu...sp=sharing

Have a form_open_multipart() instead of form_open() in your view, then
<input type="file" name="userfile" size="20"/>

will be your input file field, place anywhere you want in your view, then after initialization of your upload library call
If it fails it returns false so you can do some error logging etc. Simple as that, i wont write everything for you as your document is so terrible to work with. (especially that 2342342343 line function)

So if I understand do_upload() is a specific function from CI.
Here is the file
the googledoc has broken the code :/

I've added
'image_path' => $this->upload->do_upload(),
but I don't see how can I check the function with '$this->form_validation->set_rules' , actually the form is OK and in the database I got a 0 in the image_path...

This should help: http://ellislab.com/codeigniter/user-gui...ading.html

$this->upload->do_upload() returns TRUE/FALSE, so that's why you're getting that for the filename.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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