php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14748 ftp_put problems
Submitted: 2001-12-28 17:21 UTC Modified: 2002-04-15 22:22 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: blaloggia at cwplus dot com Assigned: vlad (profile)
Status: Closed Package: FTP related
PHP Version: 4.0.5 OS: Unix
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: blaloggia at cwplus dot com
New email:
PHP Version: OS:

 

 [2001-12-28 17:21 UTC] blaloggia at cwplus dot com
Okay, I've scoured the bug reports and the message lists and I'm not convinced that it's even possible to upload from a local file to an ftp server using ftp_put.  No one seems to have a good answer to the multiple listings of people having this problem.  I don't believe my problem is a security problem.  My problem is that PHP wants to use the directory that my PHP program is in as the default directory for uploading.  ftp_put won't recognize my C: drive as a local drive.

Here is the gist of the code that doesn't seem to be working:

$host = "ftp.cwplus.com";
$user = "username";
$password = "password";
$remotefile = "/www/cwplus/wendy/images/$filename";
$conn = ftp_connect("$host");
ftp_login($conn, $user, $password);
ftp_put($conn, $remotefile, "C:/test.txt", FTP_BINARY))

I've done all kinds of slash manipulation for the local file and none seem to help.  

Thanks,
Bob


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-26 18:40 UTC] vlad@php.net
How can you have OS: "Unix" and a C: drive? That strikes me as odd.

The example you showed works for me on a windows box
with either forward slash or backslash if you get rid of the extra closing ')' in the last line.

Do you still have this problem with php 4.1.2?
 [2002-04-04 11:51 UTC] blaloggia at cwplus dot com
Yes, I still have this problem.  As a matter of fact, I have the same problem when I use ftp_get.  It won't recognize my local drive.  It thinks the directory path is part of the file name (i.e. local path is "c:\\ftptesting\\testfile.csv".  It thinks the file name is "c"\\ftptesting\\testfile.csv").

My local machine is a Windows 2000 box and the ftp server is a Unix box.
 [2002-04-04 18:35 UTC] fred010101 at hotmail dot com
I have the same problem. 
The client on windows.
The server on unix.

$conn_id = ftp_connect($ftp_server); 
ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 
ftp_put($conn_id, "./download", "D:\essai.map", FTP_BINARY);
 [2002-04-04 18:55 UTC] kchapdelaine at cox dot net
The ftp site is on a Unix server.

The php file is on a Unix/Apache web server (actually, the same unix server).  

The file we are attempting to upload is from the directory of the person connecting to the server, i.e., usually Windows.  

This is still in the testing phase.

Ftp is properly enabled.  The server says so. I had him add code for it to show the phpinfo.

What is the proper syntax for the file on the user computer?  Or is this improper usage of the program?

i.e., do we use:

c:\\ftptesting\\test1.csv 

or
 
c:\ftptesting\test1.csv

or

c:\ftptesting\\test1.csv 

or something else entirely?

Or is there a flag we need to set to do this?

Yes, I am working with Bob on this.

Thank you,

Karen Chapdelaine
kchapdelaine@cox.net
 [2002-04-15 22:22 UTC] vlad@php.net
The problem is your definition of 'client' and 'server'.

Your client (from php point of view) is the machine where PHP resides on, *not* the machine you are uploading a file from. The server is the one you are uploading the file to, *not* the box on which PHP resides. That's why there is no 'C:' drive on your client (which is a linux/apache), and obviously that file cannot be found. Hence, my original comment about how you can have a 'C:' drive on Unix.

If I misunderstood you, and wrote something bogus, please reopen bug report. If you have more questions, email me in private.
 [2002-06-01 16:32 UTC] christoffer dot dahl at chello dot se
I've got exactly the same problem! I'm dealing with just windows. The upload.php-file is located on a windows-server. From my local Windows 2000 I try to upload a file to a third windows-server. Allways fail. Works fine creating new dirs etc, but no upload with ftp_put.
I've tried many variatons, similar to the others. Can't find a real solution from Vlad.
Could it have something to do with the proxy-bug described in http://support.microsoft.com/default.aspx?scid=kb;en-us;Q233285?

/Christoffer
 [2002-06-01 16:35 UTC] christoffer dot dahl at chello dot se
Skip the last "?"-sign in the bug-link!
/Christoffer
 [2002-07-08 22:39 UTC] Blackironj at aol dot com
when I try and upgrade to Windows 2000 when checking my drive c: as part of the set up it stops at a 5% load and then gives an error that reads " Drive c: is corrupt and beyond repair" however I use the drive c: in windows 98 and my drive c: has no problems.....do I just not have the drivers to load this upgrade and if not does anybody know where I can update my drivers
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 05:01:29 2024 UTC