2013-07-18 6 views
0

양식 대상이 iframe 인 PHP 파일 업로드 위치가 있습니다.사진 업로드가 2MB보다 큰 파일을 업로드하지 않습니다

2MB 미만의 파일을 업로드합니다. 그러나 더 큰 것은 업로드하지 않을 것입니다. 나는이 코드의 뒤에 어떤 이유로 든 볼 수 없다.

<div id="upload_wrapper"> 

<img src="../images/logo.png" alt="logo5" width="" height="" style="padding:0px;" /> 
<h3>Profile picture upload</h3> 

    <form id="upload" name="upload" enctype="multipart/form-data" method="post" action="index.php" target="upload_target"> 
    <input name="folder" type="hidden" value="<?php echo $folder ?>" /> 
    <input name="filename" type="hidden" value="<?php echo $filename ?>" /> 
    <input name="uploaded_file" type="file" size="5120" id="uploaded_file" /> 
    <input id="sent" name="sent" type="submit" value="Upload" /> 
    </form> 
</div> 
<div id="loading" style="background:url(ajax-loader.gif) no-repeat left; height:50px; width:370px; display:none;"> 
    <p style="margin-left:40px; padding-top:15px;">Uploading File... Please wait</p> 
</div> 
<div id="image_wrapper" style="display:none;"><p id="preview"></p></div> 
<iframe id="upload_target" name="upload_target" style="width:10px; height:10px; display:none"></iframe> 
</div> 

그리고 heres는 PHP를 업로드 코드

if ($_SERVER['REQUEST_METHOD'] == 'POST') { 

$targetFolder = $_POST['folder'] . "/"; 
$filename2 = $_POST['filename']; 

if (!is_dir($targetFolder)) 
{ 
    mkdir($targetFolder, 0777); 
} 

    $tempFile = $_FILES['uploaded_file']['tmp_name']; 
    $targetPath = dirname(__FILE__) . '/' . $targetFolder; 
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['uploaded_file']['name']; 

    // Validate the file type 
    $fileTypes = array('jpg'); // File extensions 
    $fileParts = pathinfo($_FILES['uploaded_file']['name']); 

    if (in_array($fileParts['extension'],$fileTypes)) 
    { 
     $uploadfile = $targetFolder. basename($filename2 .".".$fileParts['extension']); 
     move_uploaded_file($tempFile,$uploadfile); 
     $fileName = $uploadfile; 
    } 

    echo "<div id='filename'>$fileName</div>"; 

} 
+0

아마 POST/POST를 2MB로 제한하는 서버/PHP 구성 때문일 것입니다. –

+0

http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size 그냥 php.ini 파일을 수정하십시오. –

답변

1

아마 (10메가바이트 예) 도움이 될 당신의 PHP 서버의 구성을 변경 :

ini_set('upload_max_filesize', '10M'); 
0

것은 확실 php.ini 파일 구성 지원 대형하기를 파일. upload_max_filesizepost_max_size 또한 업로드 프로세스를 처리하기 전에 ini_set을 사용하여 임시로 구성을 변경할 수 있습니다.

0

의 php.ini /이 당신이 문서 루트/PHP에있는 php.ini 파일에서 편집해야 할 다른

define ("MAX_SIZE","1000"); // put your max size value 
$size=filesize($_FILES['uploaded_file']['tmp_name']); 

//compare the size with the maxim size we defined and print error if bigger 
    if ($size > MAX_SIZE*1024) 
    { 
echo '<h1>You have exceeded the size limit!</h1>'; 
$errors=1; 
    } 

또는 시도 다음 코드를 넣어 작동 할 수 있습니다 시도

0

서버 설정을 변경할 수 있습니다. php.ini 파일을 찾고 "upload_max_filesize"검색

관련 문제