Blueimp jQuery File Upload plugin with Codeigniter step by step?

https://github.com/blueimp/jQuery-File-Upload I spent 2 days on this, and nothing worked. I also downloaded the example from my website ( https://github.com/blueimp/jQuery-File-Upload/wiki/jQuery-File-Upload-6.5-with-CodeIgniter-2.1 ), but it gives syntax that I cannot fix, because everything seems normal in the code, and my editor also does not detect any syntax error ... On the other hand, the code on the example page is different from the code in the .zip that they suggest downloading.

The original demo works great, but I can’t integrate it into CodeIgniter, I don’t know how to handle everything I need. By default, it downloads all files from the directory, and I don’t need it. To add a product to the admin, the list should be empty, and the files should be uploaded to a directory like this /pictures/month/filename.ext, and at boot time it should create 3 sizes of thumbnails / images / th1 / month / filename. To edit the product, I need to load previously downloaded images from the database for a specific product, and not all the images in the folder. Lastly, the Delete function does not delete images.

As I see it, images upload without submitting a form, right? This is important because I have 10 other input fields for product details that need to be submitted with the submission of the form and stored in the database. Everything is done and works, except for the image gallery with this plugin.

Can someone help me with this?

+6
source share
2 answers

In the first place, sorry for my poor English. I do not know, you are still interested in this topic. It doesn’t matter if it is a hint to the next visitors

Do not follow the instructions for integrating with codeigniter, it makes it difficult to understand this from incomplete code, but rather get a demo source and build a solution from this point. I did it in 1 hour :)

You need to make the Codeigniter UploadHandler.php library as per the document . Inside the library, the __construct () function changes the value of script_url to the absolute path to the controller that you create.

Then create a controller and load the library inside the index function.

Change the main.js file, replace the contents of the URL: "server / php" in $('#fileupload').fileupload() with the name of your controller.

Now you can create another controller and load the view with the contents of index.php from the original demo.

If you do everything that I indicated, you should be able to use the first controller to create ajax calls from the second controller.

+8
source

@ Sinisa proved a valuable guide. I could make Fileuploader 8.8.5 version with relative ease of working with CI 2.1.3. I updated the wiki - here is the link:

https://github.com/blueimp/jQuery-File-Upload/wiki/Jquery-file-upload-8.8.5%2Cwith-codeigniter-2.1.x

+7
source

All Articles