how to create atemporay file on ftp srver

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asifkamalzahid
Forum Commoner
Posts: 36
Joined: Tue Nov 18, 2008 8:00 am

how to create atemporay file on ftp srver

Post by asifkamalzahid »

i have made conection it is working
now i want to create a temorary file on the ftp server,
what is the syntax for that,
thanks
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: how to create atemporay file on ftp srver

Post by aceconcepts »

You need to be more descriptive in your objective. Give context and ultimate goal.
asifkamalzahid
Forum Commoner
Posts: 36
Joined: Tue Nov 18, 2008 8:00 am

Re: how to create atemporay file on ftp srver

Post by asifkamalzahid »

the followind code is for to delete the a file from ftp server.
i have error message

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 is

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);
 
}
 
?>
 
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: how to create atemporay file on ftp srver

Post by aceconcepts »

Stop posting the same question
Post Reply