Validation error with multiple file downloads in Django via Ajax

I have a view to which I am trying to send multiple ajax downloads via source data (e.g. via an octet stream). These requests are submitted one by one, so that they are processed in parallel. The problem is that django considers that only the last request is valid. For example, if I send 5 files, the first four give:

Upload a valid image. The file you uploaded was either not an image or a damaged image.

I assume that this is because somehow the requests overlap? So, the image is not fully loaded before the form tries to validate it?

And the last one works great.

My download:

def upload(request): form = UploadImageForm(request.POST, request.FILES) print form if form.is_valid(): # ..process image.. 

And my image form for upload:

 class UploadImageForm(forms.Form): upload = forms.ImageField() 

To send requests, I use html5uploader js pretty much right out of the box.

+4
source share
1 answer

On the other, no, you tried https://github.com/blueimp/jQuery-File-Upload/ - this is a pretty good file loader without flash memory with a progress bar.

0
source

Source: https://habr.com/ru/post/1340975/


All Articles