NanoHttpd ライブラリを使用して、フォームからの POST 要求を使用して Android サーバーにファイルをアップロードしようとしています。サーバー側で POST リクエストを受け取ります。私の質問は、POST リクエストからファイルを取得して、デバイス メモリのどこかに保存する方法です。
フォーム :
<form action='?' method='post' enctype='multipart/form-data'>
<input type='file' name='file' />`enter code here`
<input type='submit'name='submit' value='Upload'/>
</form>
サーブメソッド:
@Override
public Response serve (IHTTPSession session) {
Method method = session.getMethod();
String uri = session.getUri();
if (Method.POST.equals(method)) {
//get file from POST and save it in the device memory
}
...
}