1
web.py 앱을 서버로 사용하고 클라이언트의 JQuery를 사용하고 있습니다. 응용 프로그램의 일부 파일을 업로드해야하고, 나는 그것을 클라이언트에두고 작업을 진행 :대용량 파일을 업로드하는 방법 AJAX + Web.py
$('#filesend').click(function(){
var xhr = new XMLHttpRequest();
xhr.open('PUT', '/ajax/file', true);
var form = $('#fileform')[0];
var fd = new FormData(form);
xhr.send(fd);
});
그리고이 서버에서 코드 :
def PUT(self):
try:
x = web.input(myfile={})
filename = data.getUserFilename(session.user, x['myfile'].filename)
data.saveFile(filename, x['myfile'].file)
except:
print sys.exc_info()
web.debug("can't save file")
return "OK"
, 나는 파일을 사용할 때 > 2GBs aprox. web.input 메서드에서 오류가 발생합니다. 나는 파일이 현재의 방법으로 업로드 만하는 큰하는 경우에는 클라이언트에서 확인 할 수 있어요
File "/usr/local/lib/python2.7/dist-packages/web/wsgiserver/__init__.py", line 1008, in readline
bline = buf.readline(size)
OverflowError: signed integer is greater than maximum
은 무엇 2GBs보다 파일을 더 업로드 할 수 있습니다?
한 :
마지막으로, 우리는 전송의 끝을 표시하는 최종 메시지를 보내 아직 안 잤니? –
필자는 최대 파일 크기를 제한하는 구성을 변경해야한다고 생각합니다. –
@AlexTwain <2GB 크기로 파일을 분할하여 해결했습니다. – Zhen