I'm working with the HTML5's File API (tutorial here) and I need to validate whether a file is an image or not. The main issue is that with a normal upload, I could call getimagesize()
and as the parameter, the path to the temporary file -- and then decide to store it on the server or not.
However, with the File Upload API, the files are received with php://input
, which returns the actual bits of the transfer.
What's the best way to validate in this situation? Do I have to store the bits to a physical location and then validate it and delete it afterwards or is it a better way?
Thanks.