FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 12th, 2002, 08:20 AM
v10 v10 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 5 v10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy ftp_put error - need help

<?php
$server="ftp.myserver.com";
$user="myuser";
$pass="mypass";

// Connect & login to FTP server
$ftp=ftp_connect($server) or die ("Problem with FTP server !");
$conn=ftp_login($ftp,$user,$pass) or die ("Problem logining on to FTP server");

$dir=ftp_pwd($ftp); // Stores current directory as $dir

$file=$dir."/uploaded/datafile.txt"; // name of file we want to upload

$localfile = "C:\testfile.txt";

$upload=ftp_put($ftp,$file,$localfile,ftp_binary) or die ("Problem with upload");

?>

RESULT : Warning: error opening
C:\datafile.txt in ......script name

Can anyone help ?

If tried replacing C:\ with C:/ and C:// and lots of other combinations !

Please Help

v10

Reply With Quote
  #2  
Old June 12th, 2002, 08:42 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed God (5000 - 5499 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 5,163 Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 6 Days 1 h 34 m 20 sec
Reputation Power: 791
What OS, I know you are running a windoze machine, but is it NT,2000,XP? If so, does the web server have permissions to read the directory you are trying to access?

Try moving the file you are trying to upload into the same directory that the script is located and see if that works.

You might also want to ftp_chdir to the exact directory you are wanting to upload to.

Last edited by Onslaught : June 12th, 2002 at 08:45 AM.

Reply With Quote
  #3  
Old June 12th, 2002, 10:01 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,912 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 31
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
Ok, first of all it should be $localfille="c:\\testfile.txt"; or $localfile='c:\testfile.txt'; and then, why do you upload .txt file in binary? Should be FTP_ASCII (note the capital letters, same with ftp_binary, should be capital)
__________________
And you know I mean that.

Reply With Quote
  #4  
Old June 12th, 2002, 10:25 AM
v10 v10 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 5 v10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ahhhhh, still not working

Ok, My Pc is running Win98SE and the server is UNIX.

The script now reads as follows :

<?php
$server="ftp.server.com";
$user="user";
$pass="pass";

// Connect & login to FTP server
$ftp=ftp_connect($server) or die ("Problem with FTP server !");
$conn=ftp_login($ftp,$user,$pass) or die ("Problem logining on to FTP server");

$dir=ftp_pwd($ftp); // Stores current directory as $dir

$file=$dir."/uploaded/datafile.txt"; // name of file we want to upload

$localfile = 'C:\testfile.txt';

$upload=ftp_put($ftp,$file,$localfile,FTP_ASCII) or die ("Problem with upload");

?>


Still no Joy, Please help.... this is bugging me .....!

Thanks for the help,

V10

Reply With Quote
  #5  
Old June 12th, 2002, 10:31 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,912 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 31
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
"no joy" as in....

Reply With Quote
  #6  
Old June 12th, 2002, 10:40 AM
v10 v10 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 5 v10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No joy as in it's still not working.

Can you help Mr. Capone ?

I read somewhere else that ftp_put can only move files from one server to another, but I don't believe that, as that wouldn't be the normal use of ftp ?

I've also seen this type of problem posted all over the place with similar type replies and no solution but I'm not a quitter.

Surely this is possible, and someone out there knows a solution.

It could be you.

C'mon, put your thinking cap on

V10

Reply With Quote
  #7  
Old June 12th, 2002, 10:51 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,912 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 31
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
>>I read somewhere else that ftp_put can only move files from one server
>> to another, but I don't believe that, as that wouldn't be the normal use
>> of ftp ?
BS. What you've just describes is called fxp'ing, and it is widely popular in..uhm... not so legitimate purposes.

What I meant is, what erros do you get? Try echoing each var before ftp_put and see if it says what you want.

Reply With Quote
  #8  
Old June 12th, 2002, 11:05 AM
v10 v10 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 5 v10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok it now reads :

<?php
$server="ftp.server.com";
$user="user";
$pass="name";

// Connect & login to FTP server
$ftp=ftp_connect($server) or die ("Problem with FTP server !");
$conn=ftp_login($ftp,$user,$pass) or die ("Problem logining on to FTP server");

$dir=ftp_pwd($ftp); // Stores current directory as $dir

$file=$dir."/ftp/datafile.txt"; // name of file we want to upload

$localfile = 'C:\testfile.txt';

echo "Connected to : $server as user : $user on Directory : $dir <br>";
echo "The plan is to upload this file : $localfile to this directory : $file on the server <br>";

$upload=ftp_put($ftp,$file,$localfile,FTP_ASCII) or die ("Problem with upload");

?>

Result :

Connected to : ftp.server.com as user : user on Directory : /
The plan is to upload this file : C:\testfile.txt to this directory : /ftp/datafile.txt on the server

Warning: error opening C:\testfile.txt in /home/ftp/ftpscript.php on line 19
Problem with upload


Appreciate the help al, what do you think ?

V10

Reply With Quote
  #9  
Old June 12th, 2002, 11:08 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,912 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 31
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
What do I think? I think this is probably the longest thread about the dummest mistake You're on unix host, and you're trying to open file c:\testfile.txt on server's hdd. Sure enough, it gives errors, and you know why? There is no c:\testfile.txt, heck there is no c:\ there is / So you'll have to edit your path accordinally.

Reply With Quote
  #10  
Old June 12th, 2002, 11:18 AM
v10 v10 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 5 v10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
huh ?

hmmm, I'm trying to upload from the users hdd to my unix server.

The file C:\testfile.txt is on the same pc as the browser right ?

I know there is no C drive on my server but the file isn't on my server, it's on a local pc with a browser running win98 that has a C drive.

Am I seriously not with it today or what ?

What way should I address the C drive of the users pc or can I ?

Thanks for bearing with me


V10

Reply With Quote
  #11  
Old June 12th, 2002, 11:45 AM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,912 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 31
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
PHP is server side langauge and therefore every file you request comes from server.
>>What way should I address the C drive of the users pc or can I?
You simply can't. At least not directly. What you could do though is to first make users upload file to server and then put it on ftp.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > ftp_put error - need help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap