0

I am looking for the correct way to retrieve file content uploaded(e.g. via multipart) without saving it to some temporary file which I think is the default behavior of Play framework.

I have read Writing-your-own-body-parser, but it does not give any idea of how I can implement a custom parser that does not require for saving the received data on disk.

Can someone provide an example?

d-_-b
  • 4,142
  • 6
  • 28
  • 43
  • The question requires to be more specific, as the mentioned [documentation](https://www.playframework.com/documentation/2.7.x/ScalaFileUpload#Writing-your-own-body-parser) is already quite clear about how to implement a custom parser. – cchantep Jul 23 '19 at 13:01
  • What described in the document(and code) is how to write a customer parser but not how to write customer parser without needing to save the data to disk. `val path = JFiles.createTempFile("multipartBody", "tempFile", attr)` this clearly for creating a file on disk – d-_-b Jul 23 '19 at 13:03
  • 1
    You need to be specific about what you would like to do with the input body, and what you've already tried about that – cchantep Jul 23 '19 at 13:12
  • This might be helpful hints https://stackoverflow.com/questions/17595091/how-to-create-new-java-io-file-in-memory/17595303 – mfirry Jul 23 '19 at 13:15
  • And for a more specific idea: https://github.com/google/jimfs – mfirry Jul 23 '19 at 13:15
  • @cchantep actually i do not really operate on the file that is uploaded, but simply upload it some cloud storage like Amazon S3. so what i want to achieve is kid of seamless upload from the upload user to the storage with saving it to disk. the upload file is some binary file files we use in our system – d-_-b Jul 23 '19 at 13:24
  • What have you already tried about that? Which lib do you intend to use? How do you provision the credentials, ... – cchantep Jul 23 '19 at 13:37

0 Answers0