Solved

i received error message Warning: ftp_put() [function.ftp-put]: /spencer: Access is denied. in C:\wamp\www\test3\index.php on line 18 Cannot upload

Posted on 2008-06-16
3
1,168 Views
Last Modified: 2008-06-16
PHP
i received error message Warning: ftp_put() [function.ftp-put]: /spencer: Access is denied. in C:\wamp\www\test3\index.php on line 18 Cannot upload
i had try to connect with ftp client software and i can upload the file

below is my code
<?php
// FTP access parameters
$host = "1.2.3.4";
$usr = "admin";
$pwd = "admin";
 
// file to move:
$local_file = 'c:/TEST/test.txt';
$ftp_path = '\\spencer';
 
// connect to FTP server (port 21)
$conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");
 
// send access parameters
ftp_login($conn_id, $usr, $pwd) or die("Cannot login");
 
// perform file upload
$upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);
 
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";
 
// close the FTP stream
ftp_close($conn_id);
?>
0
Comment
Question by:firekiller15
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 250 total points
ID: 21791954
Shouldn_t $ftp_path be 'spencer/test.txt';
0
 

Author Comment

by:firekiller15
ID: 21792534
ohh you mean i need to create a text file inorder to upload the file
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21792545
No,

You need to specify the full new filename, instead of only the directory where the file should be put.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now