title: django limiting file size and file format in view
body: <p>In my view I am getting a file like :</p>
  
  <pre><code>def add_view(request):
      if request.method == "POST":
          my_files = request.FILES.getlist("file")
          for file in my_files:
              Here if file is greater than 2 Mb raise error and send error message
              Also check if the file is of type jpg. If it is then return something 
  </code></pre>
  
  <p>How can I do this ? I want to do it by taking constant variable from settings. Like setting MEDIA_TYPE or MIME_FORMAT in settings and also file size in setting</p>