I’m struggling with redactor, specifically the image upload.
I’m sure this is something 99% of Yii projects must need so I’m hoping someone can help me.
I’ve setup Yii-redactor as here, and got it working apart from the image upload.
When I try to upload an image the uploader spins briefly and then stops and says ‘no file chosen’.
The console says:
POST http://localhost/holters_v1_3/admin/property/imageUpload 400 (Bad Request)
Can someone help me out please? I’ve been bangin my head agaist this for three days now.
This thread from last year seems to describe the same problem but with no solution.
Thanks in advance
Please post the code that calls the widget, especially the ‘imageUpload’ line.
The URL seems wrong. You didn’t explain what is your root URL or your expected controller, but I guess the right URL would be “http://localhost/holters_v1_3/someController/imageUpload”.
OK, I finally got it working by looking at the image uplad function from Janitso’s YcmModule. The code is here for anyone who interested.
I think the key that I was missing was this line:
// Make Yii think this is a AJAX request.
And if you need it the code to render redactor in the view: