Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-16-2009, 08:50 AM   PM User | #1
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
ftp_fput

Morning all im back.

here is my code:

PHP Code:
    $filesQuery mysql_query("SELECT * FROM `files` ORDER BY id") or die(mysql_error());
    
$x=0;
    
$z=0;
    
$conn_id ftp_connect($FTPhost);
    
$login_result ftp_login($conn_id$FTPuser$FTPpass);
    
    while(
$filesArray mysql_fetch_array($filesQuery))
    {
        if(
$z==0)
        {
            if(!
ftp_chdir($conn_id $ROOT."/ACT.".md5($WEBSITE)."_stylesheets/")) 
            {
                
ftp_mkdir($conn_id$ROOT."/ACT.".md5($WEBSITE)."_stylesheets/");    
            }
        }
        
$pathFromRoot $filesArray["files"];
        
$localPathFromRoot "../../users/".md5($WEBSITE)."/".$pathFromRoot;
        
        if(
file_exists($localPathFromRoot))
        {
              
$from fopen($localPathFromRoot'r');
              if(!
ftp_fput($conn_id$pathFromRoot$fromFTP_BINARY))
            {
                
$x++;
                die(
"error uploading"); //added this for testing
            
}
            
fclose($from);
        }
        
$z++;
    }
    
ftp_close($conn_id);

    if(
$x==0)
    {
        echo 
"<span style=\"green\">Files uploaded successfuly!</span>";    
    }
    else
    {
        echo 
"<span style=\"red\">File upload failed!</span>";
    } 
this worked fine for about 2 mins then stopped working saying the following

Code:
Warning: ftp_fput() [function.ftp-fput]: public_html/e6b4e0d743dbabe2b59eecf807f4b536.txt: Not a directory in /home/sites/snowyswebsolutions.co.uk/public_html/scripts/php/publish.php on line 70
what i cant understand, public_html/e6b4e0d743dbabe2b59eecf807f4b536.txt being $pathFromRoot, why it returns true for file_exists but says it doesn't with ftp_fput?

Any ideas?
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 

Last edited by Phil Jackson; 10-16-2009 at 09:00 AM..
Phil Jackson is offline   Reply With Quote
Old 10-16-2009, 09:00 AM   PM User | #2
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
it's ok, came too soon again.
PHP Code:
if(!ftp_fput($conn_id$pathFromRoot$fromFTP_BINARY)) 
to
if(!ftp_fput($conn_id"/".$pathFromRoot$fromFTP_BINARY)) 
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:22 AM.


Advertisement
Log in to turn off these ads.