My code is working fine, but I can't figure out how to catch a file arrives message in JavaScript.
I'm working with Django 2.1.
Template:
...
<form method="POST" enctype="multipart/form-data">
    {% csrf_token %}
        <div class="form-group">
            ...
            <input type="file" id="prd" name="prd" required>
        </div>
            ...
        <input id="btn_ini" type="submit" name="submit" value="Init process">
</form>
...
   <script type="text/javascript">
       document.addEventListener('???', function(){
            // I wish indicate to the user that the process is runnning and don't close the page.
            // at the moment the logic is working as spected but I can't achieve how to check in javascript  when file arrives. 
       })
   </script>
</body>
</html>
Views:
def add_destination(request):
   ...
   if request.method == 'POST':
      ...
      return handle_uploaded_file(prd)
   return render(request, 'add-destination.html')
def handle_uploaded_file(f)
   ...
   file = # processing file
   ...
   with open(file, 'rb') as f:
      file_data = f.read()
      response = HttpResponse(
      file_data, content_type='application/force-dowload')
      response['Content-Disposition'] = 'attachment; filename="proc_{}"'.format(incoming_file_name)
      return response
return None
 
    