This project is read-only.

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.


(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
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?
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: For older images that were added before the update this is what the correct url looks like: -Joey
Jun 12, 2014 at 7:36 PM
Looks like it doesn't like encrypted URL.

This works fine:

and this doesn't:

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):

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

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!