properly handle case when user wants to cancel file upload

This commit will fix particular problem with file upload.
As it was before this commit: 
 1) click on `<input type=file>` button
 2) select file
 3) hit Cancel button (or Esc)
 4) selected file will be still used as if you clicked Open button

This fix will change that in way that file chooser dialog will work exactly as intended, it won't change anything when you click Cancel.