Interesting.
I wanted to add logic to catch the upload of non-images. In the PHP example in the docs, they had this:
// Verify extension
if (!in_array(strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION)), array("gif", "jpg", "png"))) {
header("HTTP/1.1 400 Invalid extension.");
return;
}
So I added something like that to my server's backside server-side JavaScript.
But it turned out not to be necessary. The image upload dialogs (either browse or drag-and-drop) somehow don't let you select anything but images.
If that's so, why does the example add that to the handler?
There are a couple of reasons but I'll stick to the main 2: