【发布时间】:2014-11-16 22:26:35
【问题描述】:
我正在尝试创建一个允许用户将图像上传到我的服务器的应用程序。
但它总是返回:
错误代码 500:格式错误的请求
也许你知道出了什么问题......
这里是.lua 代码:
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
我用的是.php的例子:
【问题讨论】:
标签: php image upload lua coronasdk