Know what kind of data I upload in my filefield

0

It is possible to know what type of data the user is uploading in my one field upload file in a django form, all this in order to do what gmail does. that puts the separated pdf the separated images.

    
asked by Monpa 31.10.2018 в 15:36
source

1 answer

0

You should add some code to get the extension that the user upload something like this:

import os
nombre_documento, extension = os.path.splitext('midocumento.docx')
print nombre_documento
print extension
#output:
midocumento
.docx

This way you get the extension of your uploaded file, more information in the official documentation: splitext Python 2.xx documentation

splitext Python 3.xx documentation

I hope you feel lucky !!

    
answered by 31.10.2018 в 20:03