FileUpload icon indicating copy to clipboard operation
FileUpload copied to clipboard

I had to disable the Security csrfCheck to allow the photo to be uploaded.

Open sitrucp opened this issue 11 years ago • 0 comments

I had to disable CakePHP Security csrfCheck to allow photo to be uploaded.

After clicking Add File and selecting photo, the photo thumbnail showed, but I got "Error Bad Request" inline error message. The CakePHP error log showed the action was blackholed indicating 'csrf'.

A check CakePHP docn http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html indicated i needed to disable the Security for this operation using $this->Security->csrfCheck = false;

This was put in the beforeFilter() of HandlerController as follows:

function beforeFilter(){
    parent::beforeFilter();
    $this->Auth->allow("*");
    $this->Security->csrfCheck = false;
}

sitrucp avatar Jun 22 '14 23:06 sitrucp