/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] FTP Issues

So this is probably something simple im just blindly overlooking but any help is much appreciated.

I have a simple FTP script that uploads an installation script, i have other FTP scripts on the site that work perfectly except this one. Here is the code:

[code=php]
$host = ftphost;
$dir = ftpdir;
$usr = ftplogin;
$fpw = ftppw;
}
if(substr($dir, 0, 1)!=’/’){
$dir = ‘/’.$dir; }
if(substr($dir, -1, 1)!=’/’){
$dir = $dir.’/’; }
set_time_limit(120);

$conn = ftp_connect($host);
if(!$conn)
{ftp_quit($conn); header(‘Location: ../adse.php?se=2’); die(); }

$auth = ftp_login($conn, $usr, $fpw);
if(!$auth){ftp_quit($conn); header(‘Location: ../adse.php?se=2’); die(); }

ftp_put($conn, $dir.”adm/modules/updater.php”,”../../PBRes/updater.php”,FTP_ASCII);
ftp_site($conn,”chmod 777 “.$dir.”adm/modules/updater.php”);
ftp_close($conn);[/code]

it gives me no errors (other than the chmod being unsuccessful due to no file there).

Thanks,
Jeremy

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@Phill_PaffordSep 10.2008 — Hmm, need to see more code please, for the most part this looks good to me.

[code=php]
// Whats before this ?

$host = ftphost;
$dir = ftpdir;
$usr = ftplogin;
$fpw = ftppw;
}

if(substr($dir, 0, 1)!='/')
{
$dir = '/'.$dir;
}
if(substr($dir, -1, 1)!='/')
{
$dir = $dir.'/';
}

set_time_limit(120);
$conn = ftp_connect($host);

if(!$conn)
{
ftp_quit($conn); // If no conn why r u calling this?
header('Location: ../adse.php?se=2');
die(); // If the above redirect works this will not get called.
}

$auth = ftp_login($conn, $usr, $fpw);

if(!$auth)
{
ftp_quit($conn);
header('Location: ../adse.php?se=2');
die();
}

ftp_put($conn, $dir."adm/modules/updater.php","../../PBRes/updater.php",FTP_ASCII);
ftp_site($conn,"chmod 777 ".$dir."adm/modules/updater.php");
ftp_close($conn);

[/code]
Copy linkTweet thisAlerts:
@JeremyAauthorSep 10.2008 — The only thing before that is:
[code=php]if($_POST['stage']==1){[/code]
Which i have taken out the if clause and tested it that way. Are there some issues with backing out of directories like i am for the source file? Im stumped.
Copy linkTweet thisAlerts:
@Phill_PaffordSep 10.2008 — hmm, maybe try the full path instead of ../
Copy linkTweet thisAlerts:
@JeremyAauthorSep 10.2008 — Grrr.

Nothing.

I also tried FTP'ing a different file and still was nothing different.
Copy linkTweet thisAlerts:
@JeremyAauthorSep 10.2008 — Scratch that...

the file did go up, i forgot to change the ftp_site() file as well so that errored...okay so the moral of the story is, no backing out of directories? odd.

Well thank you for your time Phill.

Regards,

Jeremy A.
×

Success!

Help @JeremyA spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...