像这样的代码(上传图片时执行):
gallery = Gallery.objects.get(id=album_id)
index = gallery.photo_num +1 #index will be used in later
gallery.photo_num = index
gallery.save()
1张图片上传效果很好,但如果同时上传多张图片,使用多张上传jQuery plugin.the "gallery.photo_num“会比较混乱
如何修改代码以避免此问题
单张图片上传有效,多张图片上传无效
const data = new FormData();
//sending data to backend in the form of array
data.append("media_files", [{
uri: item.uri,
type: item.mime,
name: item.name || `filename${i}.jpg`,