Can this be done? To upload an image of the screen capture to a web server?
I am able to upload an image to the server if It is in the game file directory and I specify the name, this work fine, uploads, replaces the original.
What I require is to be able to do this from a screencapture. Trouble is this saves it to photo gallery and also I would not know the name of the file. I have looked at display.save but this again seems it may not be possible as it saves to the system.DocumentsDirectory so I am having trouble accessing it.
I think it may be easier to rename the file once it has been uploaded onto the server…
[code]
function upload()
local path = “entireScreen.jpg”
uploadBinary (path, “http://www.polishedpixel.net/magnetype/upload/upload.php”, networkListener)
end
function uploadBinary ( filename, url, onComplete )
local mime = require “mime”
–local path = system.pathForFile( filename )
local path = system.pathForFile( filename )
local fileHandle = io.open( path, “rb” )
if fileHandle then
local params = {
body = “image_file=” … mime.b64( fileHandle:read( “*a” )) … “&image_filename=”…filename
}
io.close( fileHandle )
local function networkListener ( event )
if (onComplete) then
onComplete(event);
end
return true;
end
network.request( url, “POST”, networkListener, params)
end
end
[/code] [import]uid: 21298 topic_id: 17550 reply_id: 317550[/import]