A related question was asked here move file uploaded from nanohttpd's Temporary directory to SD card
the reference questioner asks for copying an nanohttpd uploaded file to external sd card. However, if we wish to have a copy of the uploaded file inside the internal storage, how can we do it?(e.g. system assigned according to what device preference is sdcard or internal storage)
the author of the question did find a class method for making a copy of the uploaded file from the nanohttpd server (with a simple class method which copy from and to a particular directory) https://stackoverflow.com/a/4770586/1673000
however, how and where should we implement the codes? (with the proper approach in mind)
- should we implement this code into the nanohttpd source file? (e.g. NanoHttpd.java) if so, how do we implement the code into the main class file.
- are we able to keep the nanohttpd.java source file intact without modification and add this particular feature perhaps on another class file? (e.g. another class file which "extends NanoHTTPD" with some sample HTML code being parsed) or what are the recommended procedure in terms of having a clean design structure?
side note: I was hoping that I can copy the file directly after the nanohttpd operation are completed, but the temp file always gets deleted immediately after nanohttpd is turned off.
thanks for reading