Welcome! Log In Create A New Profile

Advanced

[WM] - Getting Bad Request 400 from server when trying to load an Image from server

Posted by YogiYang 
Hello,

I am trying to load an Image which is on a remote server.

The code that I am using is:
IF Length(NoSpace(sNewsPhoto)) > 0 THEN
			
			HTTPRequest(gsPhotoURL + sNewsPhoto)
			sResult is Buffer = HTTPGetResult(httpResult)
			
			IF Position(sResult,"404") THEN
				Error("Cannot load Image", "Resource name: " + sNewsPhoto) // or some other error handling to indicate the file was not found
			ELSE
				
				IF Length(sResult) > 0 THEN
					IMG_NewsPhoto = sResult	
				END
				
			END
			
		END

But I am getting the following from server:
Quote
server response
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><10><html><head><10><title>400 Bad Request</title><10></head><body><10><h1>Bad Request</h1><10><p>Your browser sent a request that this server could not understand.<br /><10></p><10><p>Additionally, a 400 Bad Request<10>error was encountered while trying to use an ErrorDocument to handle the request.</p><10></body></html><10>

The above code works like a charm another server. Both the servers are from GoDaddy.

What must be the problem and how to solve this?

TIA

--
Yogi Yang
Hi Yogi,

just an idea …. may be the Image is to large?
On iis there is the Setting maxAllowedContentLength ….
If you are on Linux there should be something similar ….

Regards

Stefan.
Hi Yogi,

First step is to copy the value of gsPhotoURL + sNewsPhoto either to the clipboard or save to a text file and inspect it for invalid characters or malformed url.

Next simply paste the URL into a browser and see if you get an error. If url is valid and you get an error from server, then something on the server is incorrectly configured. Images are considered somewhat of a default file object on most servers I've setup, so beyond that I'd have to see the url.

Regards,
Ken
Ken,

Thanks for the tip. Actually the Photos were loading in Browsers but not in app.

Now they are loading after I used URLEncode.

Somehow I missed using it!!!
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: