アップロード URL を渡すだけですdjango_upload_url
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>File Uploader</title>
<link href="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.css" rel="stylesheet">
</head>
<body>
<button data-toggle="modal" data-target="#UploaderModal"><strong>Upload Files</strong></button>
<div class="modal" id="UploaderModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Upload Files</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div id="drag-drop-area"></div>
</div>
</div>
</div>
<script src="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.js"></script>
<script>
var uppy = new Uppy.Core()
.use(Uppy.Dashboard, {
inline: true,
proudlyDisplayPoweredByUppy:false,
target: '#drag-drop-area',
showProgressDetails: true,
width: 1000,
})
.use(Uppy.XHRUpload, {
endpoint: '{% url 'django_upload_url' %}',
headers: {'X-CSRFToken': " {{csrf_token}} "},
formData: true,
fieldName: "file",
limit:1
})
uppy.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful)
location.reload();
})
</script>
</body>
</html>
プログレスバーdjangoで複数のファイルをアップロード