Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 4 Jahren, 2 Monaten
Letzter Beitrag:
vor 4 Jahren, 2 Monaten
Beteiligte Autoren:
Edwin01, Fabrice Harari

Image upload with HTTPRequest not working

Startbeitrag von Edwin01 am 05.11.2013 12:21


I want to upload an image taken with the Android tablet to a php server. I managed to get it working on the Windev Simulator, but on the Android tablet it does not work. It seems that the server receives a file with zero length. This is my code:

DataToSend is Buffer
iFileID = fOpen(sFilePath, foReadWrite)
IF iFileID -1 THEN
iSize = fSize(iFileID)
DataToSend = fRead(iFileID, iSize)

sContentType = "application/octet-stream"
IF HTTPRequest(gsRequestUrl + URLEncode(sRequest), gsUserAgent, "", DataToSend, sContentType) THEN
sResponse = HTTPGetResult()
sResponse = ""
sHTTPError = HTTPGetResult(httpHeader)

Thanks in advance for the help.

Kind regards,


Hi Edwin

the value that you can send in an httprequest are limited to what is usable in a regular URL. In particular, binary values such as those found in an image are a big nono...

So the usual technique is to encode the image content as base64, and of course to use URLencode at the end on the string to make sure that even those bytes are URL safe

Of course, the server side should do the inverse treatment to get the image

Best regards

von Fabrice Harari - am 05.11.2013 12:32
Hi Fabrice,

Thanks for the very quick reply but I think this is not the issue. This would be an issue if the image is included as a string in the url. In my case the image will be send as an application/octet-stream stream. In fact this does not differ a lot from uploading an image from a web page, or am I mistaking?


von Edwin01 - am 05.11.2013 13:07
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.