0
내 파일 업로드 경로가 올바른 폴더에 할당되지 않는 문제가 있습니다. 실제로 업로드되는 파일의 파일 이름에 대한 파일 경로를 수정합니다. 이상한가? 여기에 내가 일하고 있어요 코드 ...업로드 경로를 지정하는 PHP 로봇
여기<?php
$allowed_filetypes = array('.mp4','.gif','.bmp','.png','.html','.psd','.zip','.xml','.css','.js',);
$max_filesize = 5904288;
$upload_path = 'video';
$filename = $_FILES['userfile']['name'];
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
if(!in_array($ext,$allowed_filetypes))
die('Sorry, cannot take files over blankKB.');
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('Sorry, cannot take files over blankKB.');
if(!is_writable($upload_path))
die('We are very sorry, a problem is occurring with the CHMOD of this directory');
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
echo ' Your file was uploaded successfully, view it <a href="file.php?file=' . $filename . '" target="_blank" title="Your File">here</a>';
else
echo 'Sorry, but there was an error during the file upload. Please try again.';
?>
파일이 업로드 된 이후의 모습입니다,
videoHello.png는
플러스는 업로드하지 않습니다이다 파일을/video에있는 원하는 디렉토리에 복사합니다.
Techni cally 당신은'DIRECTORY_SEPARATOR'을 사용해야합니다. 그렇지 않으면 +1. :) – deceze
@deceze하지만 너무 못생긴다! ;) – Shad
아, 나는 그런 생각을하지 못했을 것입니다. 고마워요. :) –