error, need help
Moderator: General Moderators
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
error, need help
how to delete some file from ftp server,
i access the file on the server, but on deletion it give mee the error,
acess denied to delete the file
i access the file on the server, but on deletion it give mee the error,
acess denied to delete the file
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: error, need help
Use unlink(). But you need directory permission.
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: error, need help
i am sending this code , can you tell me how to use unlike(),
i can create and delete directory on my FTP server by using mouse, but i dont know either i need separate access permission by using php query.
i hav the following error in code
Warning: ftp_delete() [function.ftp-delete]: Access is denied. in G:\WEBROOT\wilbourn\ftptest\uploadfunctionpage.php on line 35
could not delete t.DOC
i can create and delete directory on my FTP server by using mouse, but i dont know either i need separate access permission by using php query.
i hav the following error in code
Warning: ftp_delete() [function.ftp-delete]: Access is denied. in G:\WEBROOT\wilbourn\ftptest\uploadfunctionpage.php on line 35
could not delete t.DOC
Code: Select all
<?php
//Move or Upload Folder Using PHP FTP Functions
function moveFolder($_server, $_user_name, $_user_pass, $local_dir, $remote_dir) {
echo"$_user_name <br/>";
echo"$_user_pass <br/>";
echo" directories are : <br/>";
echo"$local_dir<br/>";
echo"$remote_dir <br/>";
// set up basic connection
$_conn_id = ftp_connect($_server);
// login with username and password
$_login_result = ftp_login($_conn_id, $_user_name, $_user_pass);
// check connection
if ((!$_conn_id) || (!$_login_result)) {
$_error = "FTP connection has failed!";
$_error .= "Attempted to connect to $_server for user $_user_name";
$result = false;
} else {
$_error = "Connected to $_server, for user $_user_name";
}
$conn_id = $_conn_id;
$file = 't.DOC';
echo "Current directory: " . ftp_pwd($conn_id) . "\n";
echo "<br/>";
echo "<br/>";
if (ftp_chdir($conn_id, "$remote_dir")) {
echo "Current directory is now After changes: " . ftp_pwd($conn_id) . "\n";
echo "<br/>"; echo "<br/>"; echo "<br/>";
// try to delete $file
if (ftp_delete($conn_id, $file)) {
echo "$file deleted successful\n";
} else {
echo "could not delete $file\n";
}
// get the file list for
$buff = ftp_rawlist($conn_id, ".");
echo "<br/>";
var_dump($buff);
}
else {
echo "Couldn't change directory\n";
}
ftp_close($conn_id);
}
?
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: error, need help
Always consult the PHP manual if in doubt: http://uk2.php.net/unlink
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: error, need help
i checked but still confused how to use in my code
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: error, need help
They have lots of examples and it is rather straight forward.
I'm not going to do your work for you.
I'm not going to do your work for you.
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: error, need help
why i need to use unlike and where i need to use.
i realy dont know about this fuction. what is basically it doing?
i realy dont know about this fuction. what is basically it doing?
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: error, need help
sir
if u not intersted then please please dont reply many thanks
if u not intersted then please please dont reply many thanks
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: error, need help
I'm interested in helping people who are interested in helping themselves.
Don't get all weird about it. I've noticed you submit multiple posts quite often - it's just annoying!
Don't get all weird about it. I've noticed you submit multiple posts quite often - it's just annoying!
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: error, need help
i will not send any mulitiple post again ,but they were two different probloms i had,
Anyway thanks for your advoice and help.
Anyway thanks for your advoice and help.
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: error, need help
solved
there was problom with my folder permission rights,
there was problom with my folder permission rights,
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: error, need help
aceconcepts wrote:Use unlink(). But you need directory permission.