Valums FileUploader를 사용하고 있으며 파일을 업로드 한 후 응답을 받고 읽는 데 문제가 있습니다. 기본적으로 나는 onComplete에서 사용되는 유용한 응답을 얻기 위해 노력하고 있습니다. 성공 또는 오류 메시지 이건간에 말입니다.Valums FileUploader 업로드 후 서버의 응답이 없습니다.
아마도 여기에 서버를 콘텐츠 유형 일반/텍스트로 설정해야한다고 다른 게시물이 있습니다. 나는 그것을 확인했다. 그리고 실제로 그것은 설정이다.
어쨌든 검색을 많이하고 여러 가지를 확인했지만 아직 내 문제를 해결하지 못하는 것 같습니다. 여기
는 업 로더의 일부 단축 코드 :var uploader = new qq.FileUploaderBasic({
button: document.getElementById('btnUpChange'),
action: templateURL+'/upload.php',
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
onSubmit: function(id, fileName) {
},
onComplete: function(id, fileName, responseJSON) {
var fileMsg = responseJSON;
console.log(fileMsg);
$('#filemsg').html('<span class="red" >'+fileMsg+'</span>');
}
});
을 그리고 여기에 업로드 한 후 콘솔에서 텍스트입니다 : 내가 의도적으로 오류를 바로 던져 $ sizeLimit 작은을 설정
"[uploader] xhr - server response received"
"[uploader] responseText = File is too large"
[object Object]
시도하고 메시지를 얻으려고. 업로드가 성공적으로
$allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');
$sizeLimit = 4 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
// Call handleUpload() with the name of the folder, relative to PHP's getcwd()
$result = $uploader->handleUpload('uploads/', $replaceOldFile = true);
if ($result['success'] !== true) {
echo $result['error'];
} else {
echo $result['success'];
}
경우, 난 그냥 1이 반환받을 :
나는이 복사, 업 로더 우편에 포함 된 php.php 파일을 가져다가 이름을 변경 한 후 끝에 추가 onComplete 메소드. 나는 responseJSON.responseText를 사용하려고했는데 "undefined"를 얻었다.도움 주셔서 감사합니다.