The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> System Administration
> FTP Help
|
ftp_put error
Discuss ftp_put error in the FTP Help forum on Dev Shed. ftp_put error FTP Help forum discussing FTP practices, tips and solutions for problems with FTP on multiple platforms. File Transfer Protocol (FTP) was designed specifically for transferring files from one machine to another.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 18th, 2002, 04:36 PM
|
|
Contributing User
|
|
Join Date: Dec 2001
Posts: 286
 
Time spent in forums: 3 Days 5 h 24 m 46 sec
Reputation Power: 12
|
|
ftp_put error
I'm getting this when warning when I try the use the ftp_put command. It is : ftp_put: PORT command successful. in /......../web.cls.php on line 394. Every thing was working fine until a couple of days ago when it just stopped working.
The connection seems to be opening ok, and then it hangs when trying to right the file.
Can any one point me in the right direction of what is going wrong?
|

January 18th, 2002, 06:25 PM
|
 |
Mobbing Gangster
|
|
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
|
|
|
ftp_put: PORT command successful. in /......../web.cls.php on line 394
so you get that echoed when try to upload file? Does the file get uploaded? Weird, PORT is sort of alternative of PASS, and the difference between two is in the way how they do listing of dirs - somewhat different methods of getting info. Both of them have not much to do with file uploading, so you'll have to show some code.
__________________
And you know I mean that.
|

January 18th, 2002, 06:36 PM
|
|
Contributing User
|
|
Join Date: Dec 2001
Posts: 286
 
Time spent in forums: 3 Days 5 h 24 m 46 sec
Reputation Power: 12
|
|
|
Heres the code I'm using, two days ago it was working fine:
function upload($page,$pageName)
{
//connect to remote host
if(!($this->filetp=ftp_connect($this->ftp->host)))
{
print"ftp error";
die;
}
if(!ftp_login($this->filetp,$this->ftp->login,$this->ftp->password))
{
print'login error<br>';
}
//create a temp. file
if(!$file=fopen("temp".$this->id,"w")) {
print"error creating page $pageName<br>";
die;
}
fputs($file,$page);
fclose($file);
if(!ftp_put($this->filetp,$this->ftp->path."/$pageName","temp".$this->id, FTP_ASCII)) {
print"error putting $pageName<br>";
die;
}
//delete temp file
unlink("temp".$this->id);
//close ftp connection
ftp_quit($this->filetp);
}
It creates the temp file no problems and even creates the file on the server it is uploading to. The Uploaded file is empty though
|

January 18th, 2002, 06:47 PM
|
 |
Mobbing Gangster
|
|
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
|
|
|
Your logic is not very clear here, but lets go step by step.
For debuging purposes let $this->id be 12. Your code does create temp12 file on hdd in the same dir as php file and file does have something in it. Then it uploads temp file to ftp, but it is empty there. By what name does it upload?
|

January 18th, 2002, 06:51 PM
|
|
Contributing User
|
|
Join Date: Dec 2001
Posts: 286
 
Time spent in forums: 3 Days 5 h 24 m 46 sec
Reputation Power: 12
|
|
|
the uploaded page name is $pageName, for example index.php.
|

January 18th, 2002, 07:23 PM
|
 |
Mobbing Gangster
|
|
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
|
|
|
Uhm. I do see one problem in your problem. Why bother uploading files anyway? Why don't you just write $page into $pageName without using extra ftp connection? I mean, couldn't you just use fopen and fputs? That'll make things faster and easier...
|

January 18th, 2002, 08:18 PM
|
|
Contributing User
|
|
Join Date: Dec 2001
Posts: 286
 
Time spent in forums: 3 Days 5 h 24 m 46 sec
Reputation Power: 12
|
|
|
That could be a better solution, I'll give it a try thanks for the help.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|