ballhogjoni Posted April 13, 2011 Share Posted April 13, 2011 I am getting this error Warning: ftp_put() [function.ftp-put]: Can't open that file: Permission denied in /home/chris/public_html/site-name/wp-content/setup.php on line 62 $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); // turn on passive mode transfers (some servers need this) // ftp_pasv ($conn_id, true); $upload = ftp_put($conn_id, $file[0], $file[1], FTP_ASCII); print (!$upload) ? die('Cannot upload') : 'Upload complete'; print "\n"; The permissions to the file is 0644, if I change it to 0777 ftp_put complains and says the file is not found. How can I ftp this file? What is going on? Thanks, Chris Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 13, 2011 Author Share Posted April 13, 2011 couldn't find a fix for this and it seems as though nobody else knows. I just used curl to download the files instead of uploading them from one server to the other server. here's my code if anybody else has this problem. $newFile = "fileNameNew.php"; echo "<br>Starting<br>Target_url: http://url.com<br><br>"; // make the cURL request to $package $ch = curl_init(); $fp = fopen("$newFile", "w"); curl_setopt($ch, CURLOPT_USERAGENT,'Googlebot/2.1 (http://www.googlebot.com/bot.html)'); curl_setopt($ch, CURLOPT_URL,"http://url.com"); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FILE, $fp); $page = curl_exec($ch); if (!$page) { echo "<br />cURL error number:" .curl_errno($ch); echo "<br />cURL error:" . curl_error($ch); die(); } curl_close($ch); echo "<br>Downloaded file: $newFile"; echo "<br>Saved as file: $newFile"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.