1

I've put a file on a NanoHTTPD server like this:

private class WebServer extends NanoHTTPD {

    public WebServer()
    {
        super("hostname", 8080);
    }

    @Override
    public Response serve(String uri, Method method,
                          Map<String, String> header,
                          Map<String, String> parameters,
                          Map<String, String> files) {
        String answer = "";
        FileInputStream inputStream = null;
        try {
            inputStream = new FileInputStream(fileToUpload);
        }catch(Exception e){}
        return new NanoHTTPD.Response(Status.OK, mimeType, inputStream);
    }
}

How do I access that file in my web browser now?

Randall Stephens
  • 1,037
  • 1
  • 10
  • 16

1 Answers1

0
  1. To get the filename of the uploaded file

Map files = new HashMap();

session.parseBody(files);

Log.d(TAG, files.toString());

  1. Then you can access the file
Nicholas Ng
  • 1,428
  • 18
  • 23