จากโค้ดนี้คะเป็นโค้ด อัพโหลดไฟล์ไปโฮส แต่เมื่อไฟล์ที่มีขนาดใหญ่กว่า 2MB จะอัพโหลดไม่ได้คะ แต่ถ้าต่ำกว่า 2 MB จะอัพโหลดได้คะ หนู่ต้องแก้ไขโค้ออย่างไรดีคะ
<?php
if($_POST['submit']){
set_time_limit(8000);
//set up basic connection
$ftp_server = "ip" ;
$ftp_user_name = "user" ;
$ftp_user_pass = "pass" ;
$destination_file = '/'.$_FILES['file']['name'];
$source_file = $_FILES['file']['tmp_name'];
$size_file=$_FILES['file']['size'];
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_chdir($conn_id,"/");
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name<br/>";
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
}
// close the FTP stream
ftp_close($conn_id);
}//end $_POST[Submit]
?>
<form action="" method="POST" enctype="multipart/form-data">
<table align="center">
<tr>
<td align="right">
Select your file to upload:
</td>
<td>
<input name="file" type="file" size="50">
</td>
</tr>
</table>
<table align="center">
<tr>
<td align="center">
<input type="submit" name="submit" value="Upload image" />
</td>
</tr>
</table>
</form>