0
내 데이터베이스에 이미지 정보를 삽입하려면 PHP SQL 쿼리를 어디에 넣어야합니까? 에코 "성공"바로 전에 시도했습니다. 그러나 아무런 효과가 없었다.Ajax PHP 업로드 스크립트
<!-- Upload Button-->
<div id="upload" >Upload File</div><span id="status" ></span>
<!--List Files-->
<ul id="files" ></ul>
PHP 처리는 인 move_uploaded_file 방법 당신에게 반환하는 것을 확인해야하므로
$(function() {
var btnUpload = $('#upload');
var status = $('#status');
new AjaxUpload(btnUpload, {
action: 'upload-file.php',
//Name of the file input box
name: 'uploadfile',
onSubmit: function (file, ext) {
if (!(ext && /^(jpg|png|jpeg|gif)$/.test(ext))) {
// check for valid file extension
status.text('Only JPG, PNG or GIF files are allowed');
return false;
}
status.text('Uploading...');
},
onComplete: function (file, response) {
//On completion clear the status
status.text('');
//Add uploaded file to list
if (response === "success") {
$('<li></li>').appendTo('#files').html('<img src="./uploads/' + file + '" alt="" /><br />' + file).addClass('success');
} else {
$('<li></li>').appendTo('#files').text(file).addClass('error');
}
}
});
});
. 나는 이것이 당신이 의미하는 것이라고 가정합니다 : http://pastebin.com/niBAeyiW 그리고 그게 제가 시도한 것이고 효과가 없습니다. –
데이터베이스에 연결되어 있고 업로드 된 파일의 경로가 정확하고 쓰기 액세스 권한이 있고 쿼리가 올바른 경우 모든 것이 정상이어야합니다. 쿼리가 성공한 경우 다음과 같이 확인할 수 있습니다. mysql_query (... 쿼리 ...) 또는 die (mysql_error()); –
파일을 올바르게 업로드하고 있지만 유일한 문제는 데이터베이스 삽입입니다. 쿼리는 (mysql_error로 시도한) 출력을 생성하지 않습니다. 결코 보지 못합니다. –