• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1272
  • Last Modified:

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

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
firekiller15
Asked:
firekiller15
  • 2
1 Solution
 
RoonaanCommented:
Shouldn_t $ftp_path be 'spencer/test.txt';
0
 
firekiller15Author Commented:
ohh you mean i need to create a text file inorder to upload the file
0
 
RoonaanCommented:
No,

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now