image - photo upload with codeigniter -
I know there are so many tutorials online, but I could not work them :( Probably something bad in my system : /
Controller:
function do_upload () {$ config [/ b]
'Upload_path'] = './uploads/'; $ config ['allowed_types'] = 'GIF | JPG | PNG'; $ config ['max_size'] = '100'; $ config ['max_width'] = '1024'; $ Config ['Max_height'] = '768'; $ this-> Load-> Library ('upload', $ config); if (! $ This- & gt; upload- & gt; do_upload ()) { $ Error = array ('error' =>> $ this-> upload-> display_errors ()); $ this-> load-> ('Add_image', $ error);} and {$ data = array ('upload_data' = & gt; $ this-> upload- & gt; data ()); $ data ['id'] = $ See this-> Input-> Post ['id_work']; $ the- & gt; Load-> ('add_image', $ data);}}
View my view is Calpath: / Localhost / RL / App / Backend / View /
View:
echo form_open_multipart ('do_upload'); & Lt; Ul class = "frm" & gt; & Lt; Li & gt; & Lt; Label & gt; File: * & lt; / Labels & gt; Input gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; & Lt; / Labels & gt; & Lt; Input type = "submit" class = "btn" value = "upload" gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Form & gt;
Maybe I did something wrong with the path
Change your view
echo form_open_multipart ('backend / controllername / do_upload');
and create backend folders inside the controller folder.
Comments
Post a Comment