Quantcast
Channel: WinDev Forum
Viewing all articles
Browse latest Browse all 1914

[WM] - Download and save file in Mobile Storage

$
0
0
vello,

I am using following code to download file from web server using HTTPRequest and trying to save it to user selected location on phone. The code runs without any error but the file that gets saved is always of zero (0) byte.

Here is the code snippet that I am using:
nFID is int

HTTPRequest("[xxxxxxxx.com]; + gsFileName)
sResult is Buffer = HTTPGetResult(httpResult)

IF Position(sResult,"404") THEN
	Info(HTMLToText(sResult)) // or some other error handling to indicate the file was not found
ELSE
	IF Length(sResult) > 0 THEN		
		nFID = fCreate(gsParentPath+gsFileName)
		IF nFID > 0 THEN
			Info(fWrite(nFID,sResult,Length(sResult)))
		END
	END
END
Info("File Saved")
Close()

Is there any mistake in the code?

Please help me here.

TIA

Yogi Yang

Viewing all articles
Browse latest Browse all 1914

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>