<p>I can confirm this is a bug on <a href="http://buildwithcraft.com/help/csrf-protection" rel="nofollow">Craft 2.2.2579</a> when CSRF protection is enabled.  Will get a fix out for it shortly and update this answer when it's done.</p>

<p><strong>Update</strong>:</p>

<p>Fixed in <a href="https://buildwithcraft.com/updates#build2582" rel="nofollow">Craft 2.2.2582</a>.</p>

CC BY-SA 3.0
2014-09-04T20:35:26.113Z
2014-09-08T19:27:36.780Z
2014-09-08T19:27:36.780Z
Brad Bell
<p>Since the update to version 2.2 I can't upload assets.</p>

<p>I get this error message in the console:</p>

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

<p>And the upload stops:
<img src="https://i.sstatic.net/xNhgV.png" alt="upload error"></p>

<p>Any idea why?</p>

CC BY-SA 3.0
2014-09-04T01:32:27.220Z
Anything relevant getting logged in your craft/storage/runtime/logs files?  You can search for [error] and [warning].
Brad Bell
CC BY-SA 3.0
2014-09-04T06:31:51.420Z
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
CC BY-SA 3.0
2014-09-04T06:34:34.173Z
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
CC BY-SA 3.0
2014-09-04T06:35:06.433Z
When I set enableCsrfProtection to false the upload works.
Christian Steger
CC BY-SA 3.0
2014-09-04T06:36:24.360Z
Everything else with enableCsrfProtection enabled works fine (forms in frontend and backend editing).
Christian Steger
CC BY-SA 3.0
2014-09-04T15:00:25.417Z
Hey guys, I'm having this same issue. <h2>Bad Request</h2><p>The CSRF token could not be verified.</p>[error] [exception.CHttpException.400] exception 'CHttpException' with message 'The CSRF token could not be verified.' in */craft/app/framework/web/CHttpRequest.php:1247
Peter Tell
CC BY-SA 3.0
2014-09-08T21:33:09.450Z
This should be fixed in [Craft 2.2.2582](http://buildwithcraft.com/updates#build2582).
Brandon Kelly
<error-message><upload>
Craft 2.2 with enabled enableCsrfProtection: Failed to load resource: the server responded with a status of 400 (Bad Request)
# Craft 2.2 with enabled enableCsrfProtection: Failed to load resource: the server responded with a status of 400 (Bad Request)

(Asked by: username_0 on 2014-09-03)

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](https://i.sstatic.net/xNhgV.png)

Any idea why?

**Tags:** error-message, upload

> **Comments:**
> **username_1**: Anything relevant getting logged in your craft/storage/runtime/logs files?  You can search for [error] and [warning].  
> **username_0**: 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"  
> **username_0**: I don't know why because the Cookie is set: CRAFT_CSRF_TOKEN aebf01121550bc05e312fd6f1b628b07fde5db3bs%3A40%3A%22ed2516a95487688aafbbaa57c709811e87b79bfc%22%3B dev.local / Session 114 B ✓  
> **username_0**: When I set enableCsrfProtection to false the upload works.  
> **username_0**: Everything else with enableCsrfProtection enabled works fine (forms in frontend and backend editing).  
> **username_2**: Hey guys, I'm having this same issue. <h2>Bad Request</h2><p>The CSRF token could not be verified.</p>[error] [exception.CHttpException.400] exception 'CHttpException' with message 'The CSRF token could not be verified.' in */craft/app/framework/web/CHttpRequest.php:1247  
> **username_3**: This should be fixed in [Craft 2.2.2582](http://buildwithcraft.com/updates#build2582).  

---

## 1 answers

### Answer by username_1 on 2014-09-04. Score: 4 | Accepted answer

I can confirm this is a bug on [Craft 2.2.2579](http://buildwithcraft.com/help/csrf-protection) when CSRF protection is enabled. Will get a fix out for it shortly and update this answer when it's done.

**Update**:

Fixed in [Craft 2.2.2582](https://buildwithcraft.com/updates#build2582).


---

