<p>This is normally caused due to a 500 error and monitoring the AJAX request using your browser's dev toolbar or using the log file <code>craft/storage/runtime/logs</code> should give you a clearer picture.</p>

<p>It's possible your missing a PHP module called GD or if you have used the CraftCMS auto-update feature sometimes it misses files.</p>

<p>If you are missing the GD PHP module you can install it using your prefer package manager (yum, apt-get, brew, etc) or if installed or your using XAMPP/ MAMP you can add it to your PHP.ini and it should resolve your issue.</p>

<p>If it's missing PHP files from an auto-update you can override/ replace the <code>craft/app</code> folder using the original from Github or the CraftCMS website. This option would update your CMS in the process and shouldn't be needed if its a new install/ downloaded build.</p>

CC BY-SA 3.0
2017-03-10T06:38:55.040Z
2017-03-10T06:38:55.040Z
Regan Lawton
<p>Checking the logs is of course recommended:</p>

<pre><code>craft/storage/runtime/logs
</code></pre>

<p>However, I have personally found that failed uploads are related to "write" issues where either the directory permissions are invalid or the actual upload path doesn't exist (aka invalid).</p>

<p>One simple way to potentially obtain more information is to look at the actual HTTP response for the "upload file" AJAX request. I often do this via Chrome's Developer Tools' Network tab.</p>

<ol>
<li>Open Chrome Developer Tools</li>
<li>Click the "Network" tab.</li>
<li>Perform the file upload.</li>
<li>Click on the "uploadFile" request that was generated</li>
<li>Click the "Response" tab to view the completed response (which will appear once the response is returned).</li>
</ol>

<p><a href="https://i.sstatic.net/Bvknc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Bvknc.png" alt="Chrome Developer Tools Network Tab"></a></p>

CC BY-SA 3.0
2017-03-10T16:13:25.587Z
Hi Jarrett! Thanks for answering. I tried to obtain more information via Chrome's Developer tools network tab. When I click on the uploadFile request I get the following error in the console: net::ERR_EMPTY_RESPONSE and the response tab fails to load response data. What does this mean?
Shadi
CC BY-SA 3.0
2017-03-10T18:02:56.500Z
Does it give you a HTTP Response Code? (e.g. 400 or 500 error)? It's likely that you're encountering a PHP error which if that's the case, Brad Bell is likely right. Your PHP memory settings need to be adjusted OR you're running into an issue with the image handling (e.g. GD library). The next step is to check your PHP error log and/or the craft logs for an actual PHP error message. I would then use XDebug to do a stacktrace to identify the exact issue; however, that's likely not an option for you if your new to PHP development.. but a quick way for newcomers is to use MAMP Pro w/ PHPStorm EAP
Jarrett Barnett
CC BY-SA 3.0
2017-03-10T18:32:49.470Z
Thanks so much for the followup. I'm absolutely new to PHP development, so this issue has been very confusing for me. In response to your question, I'm receiving a 400 error code. I've checked the craft/storage/runtime/logs and found an error but I don't know what it means. What is XDebug and how do I access it? Here's my error: 2017/03/10 16:07:02 [error] [exception.Craft\HttpException.400] Craft\HttpException in /Applications/MAMP/craft/app/controllers/BaseController.php:217
etc. etc.
Shadi
CC BY-SA 3.0
2017-03-10T21:53:15.423Z
Looking at the code for that error, it seems to indicate an issue with the Request that's being generated. e.g. here's the code:
if (!craft()->request->isAjaxRequest()){ throw new HttpException(400); }

Can you perform the request again and instead of viewing the "Response" tab, can you send the Request information located in the "Headers" tab (as seen in the previous screenshot)?
Jarrett Barnett
CC BY-SA 3.0
2017-03-10T21:56:39.533Z
Also found this question and answer that could be the issue you're encountering as well: http://craftcms.stackexchange.com/questions/16374/unknown-error-occurs-on-every-ajax-call-in-cp?noredirect=1&lq=1

Which would indicate an issue with the server your website is hosted on. 

As for XDebug, it's more of an advanced tool and too complicated to explain in a StackExchange comment, but look-up a XDebug video tutorial. If you take the time to set it up, learn it and use it, you'll go far.
Jarrett Barnett
CC BY-SA 3.0
2017-03-10T06:31:29.370Z
2017-03-10T18:04:46.977Z
2017-03-10T18:04:46.977Z
Jarrett Barnett
<p><strong>*Update: Installed MAMP Pro, reinstalled Craft, asset upload is working now. Not exactly a fix, but seemed like the simplest route of action due to my unfamiliarity with PHP. Thanks to those who responded to my question.</strong></p>

<p>I'm a newcomer to web development and Craft CMS. I've downloaded and installed Craft CMS locally and I'm following along with an "Up and Running With Craft CMS" tutorial to get my bearings.</p>

<p>I am unable to upload assets via an asset field. The upload box appears and after selecting a file to upload the progress bar fills and freezes and the loading wheel spins on forever. Due to this I can't upload any images and therefore can't create my site properly. Please help!
<a href="https://i.sstatic.net/PpOGa.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PpOGa.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2017-03-10T05:50:27.397Z
Check your `craft/storage/runtime/logs` files for the underlying error as to why the asset upload failed.  99/100 times it's an environmental configuration issue (php.ini memory_limit, max_execution_time, using GD and uploading an image format it doesn't support, etc.)
Brad Bell
CC BY-SA 3.0
2017-03-10T16:17:48.033Z
Hi Brad, thank you for answering. In my craft/storage/runtime.logs files I found the following error: 2017/03/10 16:07:02 [error] [exception.Craft\HttpException.400] Craft\HttpException in /Applications/MAMP/craft/app/controllers/BaseController.php:217 What does this mean?
Shadi
CC BY-SA 3.0
2017-03-10T19:04:36.267Z
If that's the message you're getting when you try and upload, then sounds like there are some issues with your server environment: https://craftcms.stackexchange.com/questions/16374/unknown-error-occurs-on-every-ajax-call-in-cp/16398#16398
Brad Bell
<assets><image><upload>
Asset Uploading via Assets Field Broken, please help
# Asset Uploading via Assets Field Broken, please help

(Asked by: username_0 on 2017-03-10)

**\*Update: Installed MAMP Pro, reinstalled Craft, asset upload is working now. Not exactly a fix, but seemed like the simplest route of action due to my unfamiliarity with PHP. Thanks to those who responded to my question.**

I'm a newcomer to web development and Craft CMS. I've downloaded and installed Craft CMS locally and I'm following along with an "Up and Running With Craft CMS" tutorial to get my bearings.

I am unable to upload assets via an asset field. The upload box appears and after selecting a file to upload the progress bar fills and freezes and the loading wheel spins on forever. Due to this I can't upload any images and therefore can't create my site properly. Please help!
[![enter image description here](https://i.sstatic.net/PpOGa.png)](https://i.sstatic.net/PpOGa.png)

**Tags:** assets, image, upload

> **Comments:**
> **username_1**: Check your `craft/storage/runtime/logs` files for the underlying error as to why the asset upload failed.  99/100 times it's an environmental configuration issue (php.ini memory_limit, max_execution_time, using GD and uploading an image format it doesn't support, etc.)  
> **username_0**: Hi Brad, thank you for answering. In my craft/storage/runtime.logs files I found the following error: 2017/03/10 16:07:02 [error] [exception.Craft\HttpException.400] Craft\HttpException in /Applications/MAMP/craft/app/controllers/BaseController.php:217 What does this mean?  
> **username_1**: If that's the message you're getting when you try and upload, then sounds like there are some issues with your server environment: https://craftcms.stackexchange.com/questions/16374/unknown-error-occurs-on-every-ajax-call-in-cp/16398#16398  

---

## 2 answers

### Answer by username_2 on 2017-03-10. Score: 2

This is normally caused due to a 500 error and monitoring the AJAX request using your browser's dev toolbar or using the log file `craft/storage/runtime/logs` should give you a clearer picture.

It's possible your missing a PHP module called GD or if you have used the CraftCMS auto-update feature sometimes it misses files.

If you are missing the GD PHP module you can install it using your prefer package manager (yum, apt-get, brew, etc) or if installed or your using XAMPP/ MAMP you can add it to your PHP.ini and it should resolve your issue.

If it's missing PHP files from an auto-update you can override/ replace the `craft/app` folder using the original from Github or the CraftCMS website. This option would update your CMS in the process and shouldn't be needed if its a new install/ downloaded build.


---

### Answer by username_3 on 2017-03-10. Score: 2

Checking the logs is of course recommended:
craft/storage/runtime/logs

However, I have personally found that failed uploads are related to "write" issues where either the directory permissions are invalid or the actual upload path doesn't exist (aka invalid).
One simple way to potentially obtain more information is to look at the actual HTTP response for the "upload file" AJAX request. I often do this via Chrome's Developer Tools' Network tab.

Open Chrome Developer Tools
Click the "Network" tab.
Perform the file upload.
Click on the "uploadFile" request that was generated
Click the "Response" tab to view the completed response (which will appear once the response is returned).

> **Comments:**
> **username_0**: Hi Jarrett! Thanks for answering. I tried to obtain more information via Chrome's Developer tools network tab. When I click on the uploadFile request I get the following error in the console: net::ERR_EMPTY_RESPONSE and the response tab fails to load response data. What does this mean?  
> **username_3**: Does it give you a HTTP Response Code? (e.g. 400 or 500 error)? It's likely that you're encountering a PHP error which if that's the case, username_1 is likely right. Your PHP memory settings need to be adjusted OR you're running into an issue with the image handling (e.g. GD library). The next step is to check your PHP error log and/or the craft logs for an actual PHP error message. I would then use XDebug to do a stacktrace to identify the exact issue; however, that's likely not an option for you if your new to PHP development.. but a quick way for newcomers is to use MAMP Pro w/ PHPStorm EAP  
> **username_0**: Thanks so much for the followup. I'm absolutely new to PHP development, so this issue has been very confusing for me. In response to your question, I'm receiving a 400 error code. I've checked the craft/storage/runtime/logs and found an error but I don't know what it means. What is XDebug and how do I access it? Here's my error: 2017/03/10 16:07:02 [error] [exception.Craft\HttpException.400] Craft\HttpException in /Applications/MAMP/craft/app/controllers/BaseController.php:217 etc. etc.  
> **username_3**: Looking at the code for that error, it seems to indicate an issue with the Request that's being generated. e.g. here's the code: if (!craft()->request->isAjaxRequest()){ throw new HttpException(400); }  Can you perform the request again and instead of viewing the "Response" tab, can you send the Request information located in the "Headers" tab (as seen in the previous screenshot)?  
> **username_3**: Also found this question and answer that could be the issue you're encountering as well: http://craftcms.stackexchange.com/questions/16374/unknown-error-occurs-on-every-ajax-call-in-cp?noredirect=1&lq=1  Which would indicate an issue with the server your website is hosted on.   As for XDebug, it's more of an advanced tool and too complicated to explain in a StackExchange comment, but look-up a XDebug video tutorial. If you take the time to set it up, learn it and use it, you'll go far.  

---

