Error Uploading Images to Post

Topics: ASP.NET 2.0, Themes
Jun 10, 2014 at 5:11 PM
Whenever I try to upload an image to a post I get the error below. Everything works fine on my local environment, but when I go live I get the error every time with no image.

GET http://www.taxslayerpro.com/blog/FILES%2f2014%2f06%2ffiller_image.jpg.axdx net::ERR_EMPTY_RESPONSE

(anonymous function) jquery-2.0.3.js:5558
jQuery.extend.access jquery-2.0.3.js:765
jQuery.fn.extend.html jquery-2.0.3.js:5536
e angular.js:2111
(anonymous function) postcontroller.js:143
(anonymous function) angular.js:7479
A angular.js:10655
A angular.js:10655
(anonymous function) angular.js:10741
g.$eval angular.js:11634
g.$digest angular.js:11479
g.$apply angular.js:11740
g angular.js:7744
w angular.js:7918
H.onreadystatechange
Coordinator
Jun 10, 2014 at 7:33 PM
Do you have image handler registered in web.config?
Jun 11, 2014 at 1:29 PM
Yes, that is already in the web.config. Could it be a permissions issue on the server?
Coordinator
Jun 12, 2014 at 4:27 PM
The error you posted is a "get" error when trying to display image. Was it actually posted? Do you have images uploaded to /app_data/files directory? If not, what is the "post" error? Also may be look at some basic troubleshooting tips.
Jun 12, 2014 at 5:39 PM
Edited Jun 12, 2014 at 5:42 PM
I checked the app data folder and the images are actually being uploaded into the folder.
For some reason the url its producing for the image is not working: http://www.taxslayerpro.com/blog/FILES%2f2014%2f06%2fRobert_Scan.jpg.axdx For older images that were added before the update this is what the correct url looks like: http://www.taxslayerpro.com/blog/image.axd?picture=2013%2f8%2firs+video+portal.jpg -Joey
Coordinator
Jun 12, 2014 at 7:36 PM
Looks like it doesn't like encrypted URL.

This works fine:
http://www.taxslayerpro.com/blog/FILES/2014/06/Robert_Scan.jpg.axdx

and this doesn't:
http://www.taxslayerpro.com/blog/FILES%2f2014%2f06%2fRobert_Scan.jpg.axdx

Although it is essentially same thing with encoded URL in second example and both should work identically.

I believe easiest way to fix it for new files is to replace this line in core library (FileSystem/File.cs):

from:
return string.Format("{0}FILES{1}.axdx", Utils.RelativeWebRoot, this.SafeFilePath);

to:
return string.Format("{0}file.axd?file={1}", Utils.RelativeWebRoot, this.SafeFilePath);

Unfortunately this is class library, so you would need to get source code, make change, build and copy BlogEngine.Core.dll to your web server.
Jun 14, 2014 at 5:09 PM

Great, that did the trick. Thanks!