Certain files won't upload

I have built a very simple piece of code to allow customers to upload their databases to me when they are having system problems. 90% of them upload the files in ZIP format and theres no issue. I have a client that tried to upload a file with a “.BAK” extension and the uploader returns a failure (actual message is empty file name which is the $_FILES(“tmp_name”) global)

At first I thought it was file size I misread the filesize as 8Gb (it was only ~8Mb) so I set max_post_size to 8Gb (memory_limit=-1), the same problem.

If I ZIP the file it uploads fine. I am guessing that it is being caused by the system not recognizing the .BAK extension, but for the life of me, I cannot find where that is maintained.

SYSTEM INFO: Ubuntu 10.04 LTS, PHP Version: 5.3.2-1ubuntu4.14

code is below (please ignore the spelling errors)

[php]
if (isset($_FILES[“junkfilename”][“name”]) && isset($_FILES[“junkfilename”][“tmp_name”])) {

	$local_file  = $_FILES["junkfilename"]["tmp_name"];
	$remote_file = $_FILES["junkfilename"]["name"];
	
	echo "<p id=center-foot4>LOCAL: ".$local_file."</p>";
	echo "<p id=center-foot5>REMOTE: ".$remote_file."</p>";
	
	$ftpConn  = ftp_connect("files155.cyberlynk.net");
	
	if(!$ftpConn) {
		die('Unable to connect to host.  Please try again later --');
	}	else {
		echo "<p id=center-foot1>CONNECT SUCESSFULL</p>";
	}
	
	$ftpLogin = ftp_login($ftpConn,"EPAC_Upload","UpLoad");
	
	if(!$ftpLogin) {
		die('Unable to LOGIN to host.  Please try again later --');
	}	else {
		echo "<p id=center-foot2>LOGIN SUCESSFULL</p>";
	}
	
	ftp_pasv($ftpConn, true);
	
	echo "<p id=center-foot3>".ftp_systype($ftpConn)."</p>";
	
	if (ftp_put($ftpConn,$remote_file,$local_file,FTP_BINARY)) {
		echo "<p id=center-foot6>Uploaded Successfully</p>";
	}	else {
		$err = error_get_last();
		echo "<p id=center-foot6>".var_export($err)."</p>";
	}
	
	ftp_close($ftpConn);
} else {
	echo "<p id=center-foot2>UPLOAD FAILED</p>";
}

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service