업로드 스크립트를 조금만 사용해 보려고했는데 ... 할당 된 폴더에 모든 파일을 올바르게 업로드하지만 업로드에 대한 세부 정보는 mysql을 통해 추가되지 않습니다.업로드는 tempermental입니까? 데이터베이스에 새로 업로드 된 파일을 나열 할 수 없습니다!
어디에서 내가 실수를 저질렀는지 알 수 있습니까? 도와주세요.
manage.php
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'resources/uploadify.swf',
'script' : 'resources/uploadify.php',
'folder' : 'files',
'queueID' : 'fileQueue',
'auto' : true,
'onAllComplete' : function(){ alert("Thank you. All files have been uploaded successfully."); },
'multi' : true
});
});
</script>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] . '?id=' . intval($client_id); ?>">
<p>
<b>File Upload</b></p>
<div id="fileQueue"></div>
<input type="file" name="uploadify" id="uploadify" />
<p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()" class="form">Cancel all uploads</a></p>
<a href="#viewFiles" class="form" rel="facebox">View files</a>
<div id="viewFiles" style="display:none;" rel="facebox">
<div style="width:300px; height: 300px;"></div>
</div>
</p>
</form>
uploadify.php
<?php require_once('../Connections/speedycms.php);
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$fileName = $_FILES['uploadify']['name'];
$fileSize = $_FILES['uploadify']['size'];
$fileType = $_FILES['uploadify']['type'];
$client_id = mysql_real_escape_string($_GET['id']);
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts = pathinfo($_FILES['Filedata']['name']);
// if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);
echo "1";
mysql_query("
INSERT INTO tbl_accidentfiles SET client_id='$client_id', name='${fileName}', path='${targetFile}', size='$fileSize', content_type='${content_type}'");
// } else {
// echo 'Invalid file type.';
// }
}
?>
많은 감사합니다!
, 그것은 그 정보를 가지고 않습니다 이미지와 각각의 ID 필드와 테이블을 삽입 할 생각이있어? – Sarfraz
아무 일도 일어나지 않습니다 ... – methuselah