Closed alitaker closed 3 years ago
Is there any reason not to use the actual filename?
params['photo'] = (os.path.basename(filename), fileobj)
The reason is that the file name may contain special characters that may corrupt the process. Since the original code was using "dummy name", this is just a conservative way to improve it.
Of course, I remember that change now.
Prevent "Error 5: Filetype was not recognised" when uploading uncommon file types. Tested with .mts and .m2ts.
While the current flickrapi is failing with the above error, the html official uploader is working as expected, when uploading .mts and .m2ts files. I analyzed the HTTP log in the browser and noticed that the contet-type section of the actual file data was something like:
Putting the extension in the filename (instead of "dummy name") did the trick. At this time the content-type does not seem required: the filename is probably triggering an auto resolution of the content-type by the Flickr servers