I’ve succeeded in uploading files to folders on my server using codeigniter along with the Blueimp/jQuery-File-Upload plugin. However, I’m having trouble with the form action=”/upload/success” and displaying the actual “success.php” view file that one would see after successfully uploading some files.
Here’s the relevant part of the “Upload” controller:
function index() {
$this->load->view('upload/index'); // this is the index.php in the parent directory of the plugin
}
function success() {
require('server/php/index.php'); // this is the index.php inside the server folder of the plugin
// don't need to load a view file, $this->load->view('upload/success"); it's AJAX
}
So basically when I upload multiple files, the problem is that the output is text and not HTML.
Any thoughts on how to actually make the upload/success.php view file an actual HTML page?
I figured out the problem. Some of my JS files were loaded after the view file whereas others were loaded before the view files. That was just carelessness on my part, sorry.
Also, you don’t need to load a view file on the action=”/upload/success”. See the commented out section of the success() controller function above. Loading a 2nd view file also triggers a JS error. You stay on same page, the index() controller function.