I'm trying to create an app that lets the user upload an image to my server.
However it always return:
Error code 500 : Malformed Request
Maybe you have an idea what is wrong...
Here is the .lua
code:
upload:addEventListener( "tap",
function( event )
if ( isPhoto == false ) then
media.capturePhoto( { listener = onPhoto, destination = { baseDir = system.TemporaryDirectory, filename = "capture.jpg", type = "image" } } )
else
local params = { timeout = 30, progress = true, bodyType = "binary" }
local headers = {}
headers.filename = filename
params.headers = headers
network.upload( "http://www.m7-studios.de/(link to .php)", "POST", onNetwork, params, "capture.jpg", system.TemporaryDirectory, "image/jpg" )
end
return true
end )
function onPhoto( event )
if ( event.completed == true ) then
isPhoto = true
end
I'm using a example .php
: