Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ftp = "ftp";
- $username = "username";
- $pwd = "password";
- $filename = $_FILES[$xyz][$abc];
- $tmp = $_FILES['file']['tmp_name'];
- $destination = "/Content/EnquiryXML ";
- $connect = ftp_connect($ftp)or die("Unable to connect to host");
- ftp_login($connect,$username,$pwd)or die("Authorization Failed");
- echo "Connected!<br/>";
- if(!$filename)
- {
- echo"Please select a file";
- }
- else
- {
- ftp_put($connect,$destination.'/'.$filename,$tmp,FTP_ASCII)or die("Unable to upload");
- echo"File successfully uploaded to FTP";
- }
- $connect = ftp_connect($ftp) or die("Unable to connect to host");
- ftp_login($connect, $username, $pwd) or die("Authorization Failed");
- // turn passive mode on
- ftp_pasv($connect, true);
- $ftp_server = "host";
- $ftp_username = "username";
- $ftp_userpass = "password";
- $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
- $login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
- $file ="$abc";
- // upload file
- if (ftp_put($ftp_conn, "/$abc" , $file, FTP_ASCII))
- {
- echo "Successfully uploaded $file.";
- }
- else
- {
- echo "Error uploading $file";
- }
- // close connection
- ftp_close($ftp_conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement