CodeIgniter Forums
I can not download the files on a server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: I can not download the files on a server (/showthread.php?tid=60117)



I can not download the files on a server - El Forum - 01-19-2014

[eluser]Unknown[/eluser]
Hello! torment a problem - I can not download the files on a server - gives error "You did not select a file to upload.". What's the problem I do not understand.
here's the code:
Code:
function save1(){
$config['upload_path'] = './img_company/';            
                    $this->load->library('upload', $config);
            
                    if ( ! $this->upload->do_upload())
                    {  
                      echo     $this->upload->display_errors();
                        
                    }
                    else
                    {
                       echo  $this->    upload->    data();
                        
                    }
}



I can not download the files on a server - El Forum - 01-19-2014

[eluser]CroNiX[/eluser]
What does your form look like?


I can not download the files on a server - El Forum - 01-19-2014

[eluser]Unknown[/eluser]
my form is requested with "serialize()"


I can not download the files on a server - El Forum - 01-19-2014

[eluser]CroNiX[/eluser]
According to the docs, the file input must have the name of "userfile". If it doesn't, you need to explicitly set the name you used in the upload config.

I don't know what you mean by "requested with serialize()". The code you posted doesn't show using serialize() and I can only go by what you showed.



I can not download the files on a server - El Forum - 01-21-2014

[eluser]jonez[/eluser]
Are you trying to upload files through AJAX using jQuery's serialize method on the form? If you are that won't work. Check this plugin out for a solution: http://cmlenz.github.io/jquery-iframe-transport/

If you don't need to support older browsers (IE10+) you can do AJAX uploads using pure JS through the FileReader API in HTML5.