FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old July 27th, 2001, 07:24 PM
myqhenry myqhenry is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: NYC
Posts: 52 myqhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
ftp

hi,
i have writen this block of code to connect, login and upload a file to an ftp:

<?
$conn = ftp_connect("localhost");
$user = "";
$pass = "";
$result = ftp_login($conn, $user, $pass);
if(!$result)
{
echo "cannot log you in";
ftp_quit($conn);
exit;
}
$upfile = "/Inetpub/ftproot/".$userfile_name;
ftp_fput($conn, $upfile, FTP_BINARY)
?>

, but when the script runs i get this error message:

Warning: Unable to find ftpbuf 0 in c:\apache\htdocs\production\upload.php on line 11
cannot log you in

any ideas?
thanks,
MIKE

Reply With Quote
  #2  
Old July 28th, 2001, 06:52 AM
Pressly Pressly is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 48 Pressly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Lightbulb Partial Idea

It appears to be a configuration problem relating to PHP within Apache. Unfortunately, I'm just getting into this myself, so I don't know exactly where you go to fix that.

Reply With Quote
  #3  
Old July 28th, 2001, 08:28 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,535 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 10
Send a message via Yahoo to jdk
Lightbulb ftp_fput syntax.

hi u r mistaken about how ftp_fput works.
this is from manual
Quote:
int ftp_fput (int ftp_stream, string remote_file, int fp, int mode)


Returns TRUE on success, FALSE on error.

ftp_fput() uploads the data from the file pointer fp until end of file. The results are stored in remote_file on the FTP server. The transfer mode specified must be either FTP_ASCII or FTP_BINARY



u dont pass a file name to ftp_fput but a file pointer.
so correct way is this.

PHP Code:
 $fp fopen($filename,'r');


$remotefile "/upload/check.txt";
$check ftp_fput($conn_ftp,$remotefile,$fp,FTP_BINARY);
if(
$check)
    print 
"uploaded";
else
    print 
"Cant upload. 


i hope it helps,
jd
__________________
_____________________________
d.k.jariwala (JD)
~ simple thought, simple act ~
I blog @ http://jdk.phpkid.org

Last edited by jdk : July 28th, 2001 at 08:31 AM.

Reply With Quote
  #4  
Old July 28th, 2001, 10:09 AM
myqhenry myqhenry is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: NYC
Posts: 52 myqhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
ok,
I have another page that allows a user to browse the local files on his HD, now i want the user to be able to ftp his local file via ftp to my remote ftp server. This was what i was trying to do with that script.

how would i go about that,

MIKE

Reply With Quote
  #5  
Old July 28th, 2001, 10:15 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,535 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 10
Send a message via Yahoo to jdk
Lightbulb ...

hi,
i think u would have to take 2 steps here.

first let him upload the file.

as u know it would be uploaded to temp directory.

i hope u know how file uploading works in php.

once it is uploaded do a fopen and get file pointer . now provide that to ftp_fput.

once file is uploaded delete the uploaded file from temp directory.

getting ??
jd

Reply With Quote
  #6  
Old July 28th, 2001, 10:53 AM
myqhenry myqhenry is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: NYC
Posts: 52 myqhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
ok, why cant i bypass the temp directory.
lemme explain what exactly this is for. I run a website for a publisher and am setting up a backend for our advertisers to upload and view their ads from our in-house file server. So the script will be executed from the remote webserver, not hosted by us, and will upload the file to our file server in our office. But i also have apache on our file server so i can have the backend hosted on our file server. Which is the better way to go? Now one major problem with this is that these files can exced 10MB, so i figured that if u used ftp the browser and php would not timeout, is this true? If not, should i use cURL or maybe something with sockets. I just got started with php and have a very week idea of c++ and c.


MIKE

Reply With Quote
  #7  
Old July 28th, 2001, 11:04 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,535 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 10
Send a message via Yahoo to jdk
Arrow hm..

Quote:
ok, why cant i bypass the temp directory.


...hm..i dont think it would be possible to upload file DIRECTLY from user to ftp account. anyways check out others views.

Quote:
lemme explain what exactly this is for. I run a website for a publisher and am setting up a backend for our advertisers to upload and view their ads from our in-house file server. So the script will be executed from the remote webserver, not hosted by us, and will upload the file to our file server in our office. But i also have apache on our file server so i can have the backend hosted on our file server. Which is the better way to go?


fine..i got the whole idea.
idea is good.
i dont get u by what u mean to say which way to go ??
i think u have only one ftp server right ? plz give more clarification.

and in general, u should opt for ftp server, to which script would be able to communicate at MORE speed. using ur own server would be slow as u wont have as fast link as ISPs do.right ??

Quote:
Now one major problem with this is that these files can exced 10MB, so i figured that if u used ftp the browser and php would not timeout, is this true? If not, should i use cURL or maybe something with sockets. I just got started with php and have a very week idea of c++ and c.


hm..i dont think u would be able to upload 10mb through a php file. certainly it would timeout if client doesnt have FAST connection. and let me emphasize FAST.

btw i dont have any idea about cURL,plz let me know what it is.
i think u would have to find some other way round,
jd

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > ftp


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway