I use rest to post upload files, no file_entity but core file, following this but uploaded files are corrupted.
My post url:
https://domanin/file/uploa