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,160 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

758 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

22 Experts available now in Live!

Get 1:1 Help Now