Added the possibility to use a filename instead of a file object to upload images