I have a script to upload files using the FTP functions so I could upload files larger then the hostings limits.
Problem is the source of the file.
When initiating script on my local server to upload to the remote location which is my hostings server, all is well. Successful upload of 28MB file.
But, when initiating script from hosting server to upload to the remote location, it fails at the ftp_put() function.
Can anyone help with the solution of this issue.
<?php
require("../Settings.php");
require("MC_Settings.php");
ini_set('max_execution_time','1200');
$catsql = mysql_query("SELECT * FROM media_categories WHERE catID = ".$_POST["catID"]."") or die (mysql_error());
$cat = mysql_fetch_array($catsql);
if (isset($_POST["add"])) {
$source_file = str_replace("\\","/",$_POST["source_file"]);
$filename = basename($source_file);
$destination_path = $directory_path."/".$cat["catName"]."/".$filename;
//echo $destination_path."<br>".$source_file;
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
header("Location: ../index.php?page=Media_Center/MC_Manager&back=2");
exit;
} else {
// upload the file
$upload = ftp_put($conn_id, $destination_path, $source_file, FTP_BINARY);
if (!$upload) {
header("Location: ../index.php?page=Media_Center/MC_Manager&back=3");
ftp_close($conn_id);
exit;
} else {
ftp_close($conn_id);
}
}
}
?>