我上传了多个文件到django,当我保存文件时,它只保存了一个。 执行示例:
------------------------------------ start files ------------------------
<MultiValueDict: {u'patientFiles': [<InMemoryUploadedFile: Registro VFC JOSE DE LA CRUZ_16_03_2015.txt (text/plain)>, <InMemoryUploadedFile: JDTD datos vfc_27_04_2015.txt (text/plain)>]}>
*-1-*Registro VFC JOSE DE LA CRUZ_16_03_2015.txt
*-2-*<django.core.files.storage.FileSystemStorage object at 0xaf731aac>
*-1-*JDTD datos vfc_27_04_2015.txt
*-2-*<django.core.files.storage.FileSystemStorage object at 0xaf731e4c>
*-3-*JDTD datos vfc_27_04_2015.txt
*-4-*JDTD%20datos%20vfc_27_04_2015.txt
--------------------------------------------------------------------------
你可以看到它一次转到3点和4点,它不保存第一个文件。 你知道吗?在
谢谢,下一个是密码。在
这是django服务器代码:
^{pr2}$这是HTML代码:
<form id="SuPF" class="form-group" enctype="multipart/form-data" action="/formSingupPatient" method="POST">
<input type="file" multiple="true" name="patientFiles">
<button type="submit" id="SubmitForm" class="btn btn-default">Submit</button>
</form>
最后我用python的filesapi保存了很多文件。我用以下内容更改startFiles代码:
我用缓冲区创建一个文件并保存文件。在
在settings.MEDIA根目录是保存文件的系统路径。在
我希望对你将来有所帮助。在
相关问题 更多 >
编程相关推荐