왜 내 서버가 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> ' . $fileName . '<p><i><u>Size:</u> ' . $fileSize . 'k' . '<p><u>Type:</u> ' . $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)
그러나 효과가 없습니다! 어떤 제안?
이 내가 display_errors를 받고 있어요 무엇 = 1 은 register_globals = post_max_size을 = 32M post_max_size을 + 1 = 33 post_max_size (바이트) = 33554432 – methuselah