0
파일 형식을 얻으려면 $_FILES['Filedata']['type']
을 사용하고 있지만 업로드하는 모든 파일 (예 : .jpg/.pdf/.txt 등)에 대해서는 "application/octet-stream"
이 표시됩니다.업로드 jquery - 업로드 된 파일 형식이 잘못 되었음
아무도 도와 드릴 수 있습니까? 어떤 도움
<form>
<div id="queue"></div>
<input id="file_upload" name="file_upload" type="file" multiple="true">
</form>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadify({
'auto' :true,
'multi':true,
'swf' : 'uploadify.swf',
'uploader' : 'uploadify.php',
'method' : 'post',
'formData':{'token':'xyz'},
'onUploadSuccess' : function(file, data, response) {
alert(data); }
});
});
</script>
uploadify.php
$targetFolder = 'uploads';
$verifyToken = $_POST['token'];
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
echo $_FILES['Filedata']['type'];
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $targetFolder;
$targetFile = rtrim($targetPath,'/').'/'.$_FILES['Filedata']['name'];
if (move_uploaded_file($tempFile,$targetFile)) {
echo 'Copied successfully';
}
}
감사합니다.