Since the update to version 2.2 I can't upload assets.

I get this error message in the console:

Failed to load resource: the server responded with a status of 400 (Bad Request)

And the upload stops: upload error

Any idea why?

  • Anything relevant getting logged in your craft/storage/runtime/logs files? You can search for [error] and [warning]. – Brad Bell Sep 4 '14 at 1:32
  • Found this error in the logfile: "2014/09/04 06:21:06 [error] [exception.CHttpException.400] exception 'CHttpException' with message 'The CSRF token could not be verified.' in /home/netsh107500/html/craft/app/framework/web/CHttpRequest.php:1247" – Christian Steger Sep 4 '14 at 6:31
  • I don't know why because the Cookie is set: CRAFT_CSRF_TOKEN aebf01121550bc05e312fd6f1b628b07fde5db3bs%3A40%3A%22ed2516a95487688aafbbaa57c709811e87b79bfc%22%3B dev.local / Session 114 B ✓ – Christian Steger Sep 4 '14 at 6:34
  • When I set enableCsrfProtection to false the upload works. – Christian Steger Sep 4 '14 at 6:35
  • Everything else with enableCsrfProtection enabled works fine (forms in frontend and backend editing). – Christian Steger Sep 4 '14 at 6:36

I can confirm this is a bug on Craft 2.2.2579 when CSRF protection is enabled. Will get a fix out for it shortly and update this answer when it's done.


Fixed in Craft 2.2.2582.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.