How to copy InMemoryUploadedFile object to disk

后端 未结 5 646
别那么骄傲
别那么骄傲 2020-11-29 02:09

I am trying to catch a file sent with form and perform some operations on it before it will be saved. So I need to create a copy of this file in temp directory, but I don\'t

5条回答
  •  无人及你
    2020-11-29 03:04

    Your best course of action is to write a custom Upload handler. See the docs . If you add a "file_complete" handler, you can access the file's content regardless of having a memory file or a temp path file. You can also use the "receive_data_chunck" method and write your copy within it.

    Regards

提交回复
热议问题