How can i find extension of list of files .I am currently using os.path.splitext which is not working.Please suggest any other method in case of file list.
My code goes here:
files = request.FILES.getlist('media')
for f in files:
p = os.path.splitext(f)[1]
print p
It shows the error 'InMemoryUploadedFile' object has no attribute 'rfind'
Thanks in advance
From the error and the code it seems you are using Django, so you should get the object name and not the object itself as:
p = os.path.splitext(f.name)[1]
which will give the file name and not the file object.