What is the reason why you have been using PHP as a broker between the client and Flask? Why not use Flask directly?
But, maybe you need to rename the files when they are moved between folders in the PHP script, for example, if you receive an image called test1.jpg you could try renaming the file by adding some of the timestamp then the file name finally called test1-12123434.png the point is to avoid the probable cache problems with the files at the PHP server