Apache / Server Archives
Did you know that you can set php.ini values right inside the .htaccess file? It’s actually very easy.
The .htaccess Code
#format
php_value setting_name setting_value
#example
php_value upload_max_filesize 10M
Of course you could simply place these in the php.ini file, but .htaccess is a viable alternative if your host doesn’t allow you to touch the php.ini file.
Sending files to a server via FTP is an essential ability of any web developer or designer. Of course, we all use glossy FTP clients like WS_FTP and FireFTP, but what about FTP automation? You can use PHP to FTP files from one server to another. Let me show you how.
The PHP
$connection = ftp_connect($server);
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
if (!$connection || !$login) { die('Connection attempt failed!'); }
$upload = ftp_put($connection, $dest, $source, $mode);
if (!$upload) { echo 'FTP upload failed!'; }
ftp_close($connection);
Obviously, the first task is to connect to the other server. Once the connection is created, you pass the login credentials. Once you’re logged in, you can use the ftp_put() function to send the file. That’s it!
The file upload size limit is usually set pretty low by shared hosting providers. Why? To save bandwidth, keep the server moving quickly, and think about it — how many customers really need a large upload limit? If you do need to increase the maximum upload limit, all you need to do is place the following code snippet in your php.ini file:
file_uploads = On
upload_max_filesize = 10M //needs to be in {x}M format
Note that not all hosting providers allow customers to increase the file upload limit. Take that into consideration when purchasing your customer’s web hosting.