Here are the scripts:
Code: Select all
<?php
$linksto = $_POST['linksto'];
$name = $_POST['name'];
$name = $_FILES['thefile']['name'];
$bass = basename($_FILES['thefile']['name']);
$filename = $_FILES['thefile']['tmp_name'];
$ftp_server = "(SERVER NAME)";
$ftp_user_name = "(USER NAME)";
$ftp_user_pass = "(MY PASSWORD)";
$destination_file = "/public/images/buckets";
$conn_id = ftp_connect($ftp_server) or die(mysql_error());
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die(mysql_error());
ftp_pasv($conn_id, true);
ftp_chdir($conn_id,$destination_file) or die("<p>Could not change directory</p>");
ftp_put($conn_id, $name, $filename, FTP_BINARY) or die(mysql_error());
ftp_close($conn_id); // close the FTP stream
$url="/images/buckets/".$bass;
$con = mysql_connect('jankanas.db', 'JReidy', 'lalyriy') or die(mysql_error());
mysql_select_db('images') or die(mysql_error());
$sql="INSERT INTO buckets (name, url, link) VALUES ('$name', '$url', '$linksto')";
mysql_query($sql) or die(mysql_error());
mysql_close($con);
header("location:http://jreidywebdesign.com/admin/setbuckets");
?>Code: Select all
<?php
$name = $_FILES['thefile']['name'];
$filename = $_FILES['thefile']['tmp_name'];
$bass = basename($_FILES['thefile']['name']);
$ftp_server = "(SERVER NAME)";
$ftp_user_name = "(USER NAME)";
$ftp_user_pass = "(MY PASSWORD)";
$destination_file = "/public/images/";
$conn_id = ftp_connect($ftp_server) or die(mysql_error());
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die(mysql_error());
ftp_pasv($conn_id, true);
ftp_chdir($conn_id,$destination_file) or die("<p>Could not change directory</p>");
ftp_put($conn_id, $name, $filename, FTP_BINARY) or die(mysql_error());
ftp_close($conn_id); // close the FTP stream
$url='/images/'.$bass;
$con = mysql_connect('db', 'UserName', 'Pass') or die(mysql_error());
mysql_select_db('images') or die(mysql_error());
$sql="INSERT INTO images (filename, imageurl) VALUES ('$bass', '$url')";
mysql_query($sql) or die(mysql_error());
mysql_close($con);
header("location:http://jreidywebdesign.com/admin/upload?submitB=Y");
?>