Upload File - Android to Google App Engine (PHP) -
from android app google app engine, i'm posting zip file; i'm posting string. when google app engine php script runs, dump value of $_files log by...
ob_start(); var_dump($_files); $result = ob_get_clean(); syslog(log_debug, "var dump\n" . $result . "\n");
i log value of string. log has string output doesn't have $_files dumped output. read this link, seems pertain web. android code post file follows...
private void postexamplesziptodrive(file file_zip){ requestparams request_params = new requestparams(); request_params.put("test", "came thru"); // try{ request_params.put("file_zip", file_zip); } catch(filenotfoundexception e){ log.e("postexamplesziptodrive", "file not found"); toast.maketext(this, "unable upload.", toast.length_short).show(); return; } asynchttpclient async_http_client = new asynchttpclient(); async_http_client.post(upload_url, request_params, new jsonhttpresponsehandler(){ @override public void onsuccess(int code_status, header[] headers, jsonarray success) { toast.maketext(getapplicationcontext(), "" + code_status, toast.length_short).show(); super.onsuccess(code_status, headers, success); } @override public void onfailure(int code_status, header[] headers, string string_response, throwable throwable){ toast.maketext(getapplicationcontext(), "" + code_status, toast.length_short).show(); log.e("onfailure", code_status + "\n" + string_response); } }); }
my question is, posting .zip file correctly? how capture files uploaded stored in $_files?
you can use direct file upload function in php55 (see https://gae-php-tips.appspot.com/2015/03/09/direct-file-uploads-for-php-5-5/).
Comments
Post a Comment