GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 19-Jun-2005, 17:13
monki.sf monki.sf is offline
New Member
 
Join Date: Jun 2005
Posts: 1
monki.sf is on a distinguished road

ftp image upload to a different server


Hello - I've put together this form to upload images to my ftp server. This seems to work ok for upload to the server my script is running on - however - I'm making the connection to another ftp server. The other ftp server is where I'm trying to upload the files to.

Can anyone help this newbie??

PHP Code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>file upload</title>
</head>
<?php
$ftp_server = "ftp.anysite.com";
$ftp_user = "user";
$ftp_pass = "pass";

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
  echo "Connected as $ftp_user@$ftp_server\n";
} else {
  echo "Couldn't connect as $ftp_user\n";
}

// close the connection
ftp_close($conn_id);  

?>
<body>
<?php
$path = 'ftp.anysite.com/UPLOAD_TEST';


if(isset($_FILES['file']) && is_uploaded_file($_FILES['file']['tmp_name']))
{
$filename = $_FILES['file']['tmp_name'];
$destination = $path . $_FILES['file']['name'];
if (file_exists($destination))
{ echo 'File already exists!<br />'; }
else
if(move_uploaded_file($filename,$destination))
{ echo 'File uploaded!<br />'; }
else
{ echo ' ** Failure! ** <br />'; }
}

?>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload Image" action="thisform">
</form>
</body> 

Last edited by LuciWiz : 20-Jun-2005 at 01:23. Reason: Please insert your Php code between [php] & [/php] tags
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
GIM gidedit - a fltk fluid resize project cable_guy_67 FLTK Forum 2 01-Jun-2005 16:00
Microsoft SQL Server :: SQL Server message 241, state 1, severity 16 lyuboe MySQL / PHP Forum 0 11-May-2005 05:31
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 22:47
uploading files into server prinzekay MySQL / PHP Forum 5 16-Mar-2004 01:00
· Windows 2003 Server Reseller Special: Unlimited Domains/2 GB Space/for $19.99 contactsonia Web Hosting Advertisements & Offers 0 09-Jan-2004 06:46

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:43.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.