2010-03-01 3 views
2

왜 내 서버가 1MB가 넘는 파일을 허용하지 않는지 이해할 수 없습니다. cpanel을 사용하고 있는데 내 호스트가 내 php.ini 파일을 직접 편집 할 수 없다고 말했습니다.파일 업로드가 1MB로 제한 되나요?

내 업로드 코드 :

<?php 
if (array_key_exists('uploadfile', $_POST)) { 
    $fileName = $_FILES['userfile']['name']; 
    $tmpName = $_FILES['userfile']['tmp_name']; 
    $fileSize = $_FILES['userfile']['size']; 
    $fileType = $_FILES['userfile']['type']; 

    $fp  = fopen($tmpName, 'r'); 
    $content = fread($fp, filesize($tmpName)); 
    $content = addslashes($content); 
    fclose($fp); 

    if (!get_magic_quotes_gpc()) { 
     $fileName = addslashes($fileName); 
    } 

    mysql_query("INSERT INTO tbl_vehiclefiles (`veh_id`,`name`,`type`,`size`,`content`) 
VALUES ('$veh_id', '$fileName', '$fileType', '$fileSize','$content')"); 

    echo '<b>File Upload</b><p>Thank you. The file has been successfully uploaded. 

<p><img src="resources/spacer.gif" alt="" width="300px" height="5px" /><p><o> 

<i><u>Name:</u>&nbsp;' . $fileName . '<p><i><u>Size:</u>&nbsp;' . $fileSize . 'k' . '<p><u>Type:</u>&nbsp;' . $fileType . '</i><p><p><img src="resources/spacer.gif" alt="" width="300px" height="5px" />'; 

    $file_id = mysql_insert_id(); 

    echo "</i><p><a href='managevehicle.php?id=$veh_id' class='form'>Manage details</a><p> 
     <a href='viewfile2.php?id=$file_id' class='form'>View details</a><p>"; 
    exit; 
} 
?>  

<b>File Upload</b></p> 
    <p> 
    <input type="hidden" name="MAX_FILE_SIZE" value="200000000"> 
    <span id="sprytextfield1"> 
    <input name="userfile" type="file" id="userfile"> 
    </span><BR /> 
    <input type="hidden" name="uploadfile" value="1"/> 
    <input name="upload" type="submit" id="upload" value=" Upload "> 
    </p> 

나는 내 자신의 php.ini 파일을 생성하고 php.ini의 값의 일부를 재정의의 cPanel 파일 관리자에 저장 수 있다고 들었다. 이것은 내가 지금 당장 가지고있는 것입니다 :

//Common local changes: 

upload_max_filesize = 20M; // (default 8 - Max, 32) 
post_max_size = 20M; // (Average, 20 - Max, 32) 
register_globals = Off; // (off by default - you can turn On) 
allow_url_fopen = On; // (off by default - you can turn to On) 
memory_limit = 24M; // (default of 8M, Max 32) 

그러나 효과가 없습니다! 어떤 제안?

답변

3
내가 init_get와 최대 업로드 크기 읽어 시작할 것

-이 당신의 값이 허용되고 있는지 확인하기 위해 수행 : 당신이 당신의 스크립트로 값을 변경하려는 경우, 당신은 init_set 사용할 수 있습니다 http://php.net/manual/en/function.ini-get.php

를 : http://php.net/manual/en/function.ini-set.php

+0

이 내가 display_errors를 받고 있어요 무엇 = 1 은 register_globals = post_max_size을 = 32M post_max_size을 + 1 = 33 post_max_size (바이트) = 33554432 – methuselah

2

변경 는

.htaccess 파일은 아파치 웹 서버에 적용을 .htaccess합니다. 아파치가 사용하는 특정 설정을 추가하고 변경하는 파일로, 루트 폴더 (및 그 아래의 모든 폴더는 해당 설정을 사용합니다)에 배치됩니다. 아파치 모듈로 PHP를 사용하는 경우, 당신은 htaccess로 파일에 다음 설정을 추가 할 수 있습니다

php_flag file_uploads On 
php_value memory_limit 8M 
php_value post_max_size 8M 
php_value upload_max_filesize 2M