Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Flask / Python. Get mimetype from uploaded file

@app.route('/upload_file', methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        file = request.files.get('file')
        if file:
            mimetype = file.content_type
            filename = werkzeug.secure_filename(file.filename)
            file.save(os.path.join(UPLOAD_FOLDER, filename)
            return redirect(url_for('uploaded_file'))
        else:
            return redirect(url_for('upload'))
Comment

PREVIOUS NEXT
Code Example
Python :: covert docx to pdf with libraoffice in python 
Python :: what is fn.call 
Python :: webex teams api attach file 
Python :: decision tree algorithm 
Python :: how to skip number in while loop python 
Python :: Range all columns of df such that the minimum value in each column is 0 and max is 1. in pandas 
Python :: How to build a Least Recently Used (LRU) cache, in Python? 
Python :: searching for best k values in knn 
Python :: numpy sum 
Python :: python select from list by boolean list 
Python :: filter function in python 
Python :: python function 
Python :: python take input without displaying it 
Python :: 151 - Power Crisis solution 
Python :: python mongodb docker 
Python :: pdfs in django 
Python :: python stop stdout 
Python :: if syntax in python 
Python :: variable bound to a set python 
Python :: check if binary tree is balanced python 
Python :: python write data to file with permissions 
Python :: list length python 
Python :: check whether number is even or odd 
Python :: installing intel-numpy 
Python :: making your own range function with step in python 
Python :: image resolution extracting python 
Python :: how to add some thing in python list 
Python :: {} string python 
Python :: How To Remove Elements From a Set using pop() function in python 
Python :: Insert between Characters Python 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =