The code fragment you posted:
LrHttp.post(h.serverUrl .. h.uploadPath, readFileChunk(srcFilename, 10000),
is passing the result of calling readFileChunk() rather than a callback function. Thus, it is only getting called once. I think you'll probably want to do something like:
LrHttp.post(h.serverUrl .. h.uploadPath, function () return readFileChunk(srcFilename, 10000) end,
thanks for your prompt response, once again. I really appreciate your help!
Stupid me! You 're totally right, I wanted the chunk reader function to be used as callback not its result. The original code was misleading me. I'll check it in the evening, but I'm pretty sure it will work that way!
When I used to be a developer and then a manager, one of my mottos was, "Two pairs of eyes".
Jep, sometimes it takes two pairs of eyes!
Works as expected. Using chunks of 10 MBytes seems to be slightly faster than using LrFileUtils.readFile() at least for large video files.
The code is quite straight forward after all:
local postFile = io.open(srcFilename, "rb")
if not postFile then return false end
local respBody, respHeaders = LrHttp.post(h.serverUrl .. h.uploadPath, function () return postFile:read(10000000) end, postHeaders, 'POST', timeout, fileSize)