Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
1,250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 1000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 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