Blank side ved upload
Hejsa,Jeg har et mærkeligt problem.
Når jeg uploader store filer (+3MB) så får jeg mange gange en blank side i stedet for en "confirm" eller "error" meddelse og filen bliver ikke uploaded (med FTP). Hvis jeg derimod ændre det så jeg "udskriver" fil størrelsen på den uploaded fil og afslutter med exit(), så viser den størrelsen på alle uploads (tmp). Nogle forslag hvad der kan være galt? Upload virker næsten altid med små filer (10-100KB).
Test url:
http://www.savefile.com/filehost/test.php
Uploader (test2.php):
<?
/*
echo $_FILES['upld_file']['size']." Bytes";
exit();
*/
//Check if any file is submitted
if (!$_FILES['upld_file']['name']) {
echo "<font color=red>No file selected</font>";
exit();
}
//Get file name
$file_name = $_FILES['upld_file']['name'];
//FTP server info
$server_ip = "xxx.xxx.xxx.xxx";
$server_ftp_username = "user";
$server_ftp_password = "pass";
//Open the FTP connection
$conn_id = ftp_connect($server_ip);
$login_result = ftp_login($conn_id, $server_ftp_username, $server_ftp_password);
//Check if FTP connection is open
if ($login_result == false) {
echo "<font color=red>Not able to connect to FTP (FS01)<br />
Please contact the webmaster, (<a href='http://www.savefile.com/forums'>Support Forums</a>)</font>";
exit();
}
//Get destinations
$to_file = "testuploads/".$file_name;
$from_file = $_FILES['upld_file']['tmp_name'];
//ascii filetypes
$ascii_filetypes = array('htm', 'html', 'shtml', 'cnf', 'css', 'forward', 'map', 'pwd', 'txt', 'grp', 'ctl', 'nfo');
if (in_array($file_type, $ascii_filetypes)) {
//Upload the file to the fileserver using BINARY mode
$ftp_upload = ftp_put($conn_id, $to_file, $from_file, FTP_ASCII);
echo "mode: FTP_ASCII <br /><br />";
}else{
//Upload the file to the fileserver using ASCII mode
$ftp_upload = ftp_put($conn_id, $to_file, $from_file, FTP_BINARY);
echo "mode: FTP_BINARY <br /><br />";
}
//Check if upload went okay
if($ftp_upload == true) {
//Get filesize in MB
$file_size = $_FILES['upld_file']['size']/1024;
$file_size = round($file_size,2);
echo "SUCCESS <br />
<br />
Filesize: $file_size KB<br />
<br />
(this is only a test upload)";
}else{
echo "<font color=red>Error uploading the file (FTP)</font>";
}
//Close the FTP connection
$ftp_close = ftp_close($conn_id);
if (!$ftp_close) {
echo "<font color=red>Error closing the FTP connection<br />
Please contact the webmaster, (<a href='http://www.savefile.com/forums'>Support Forums</a>)</font>";
exit();
}
?>
