Fixed code to successfully add file to media library.