FTP problem

A

Anonymous

Guest
Hello,

I seem to have a problem using the FTP functions provided by php. Especially the function ftp_put - I keep getting errors that it can't create a temporary file in the directory. What could cause this?? Maybe something with write access? How do I check this? I DO have FTP support enabled though...

thanks in advance,

P3x :?
 
p3x said:
Hello,

I seem to have a problem using the FTP functions provided by php. Especially the function ftp_put - I keep getting errors that it can't create a temporary file in the directory. What could cause this?? Maybe something with write access? How do I check this? I DO have FTP support enabled though...

thanks in advance,

P3x :?
by default youre temp dir is ./ check it
 
This is the code I use:

<?php
if ($_POST['submit']){
$ftpServer = "server.com";
$ftpUser = "name";
$ftpPass = "password";

set_time_limit(160);

$conn = @ftp_connect($ftpServer)
or die("Couldn't connect to FTP server");

$login = @ftp_login($conn, $ftpUser, $ftpPass)
or die("Login credentials were rejected");

if ((!$conn) || (!$login)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftpServer for user $ftpUser";
exit;
}
else {
echo "Connected to $ftpServer, for user $ftpUser";
}
$workingDir = ftp_pwd($conn);
echo "<br>You are in the directory: $workingDir<br><br>";

$destination_file = $_FILES['fupload']['name'];
$source_file = $_FILES['fupload']['tmp_name'];

// upload the file
$upload = ftp_put($conn, $destination_file, $source_file, FTP_BINARY);


// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}

} else {
?>
<form action="ftp.php" method="post" ENCTYPE="multipart/form-data" >
<input type="file" name="fupload">
<input type="submit" name="submit" value="submit">
</form>
<?
}

?>


I got this error:
Connected to server.com, for user admin
You are in the directory: /


Warning: ftp_put: calendar.zip: Permission denied in /home/httpd/vhosts/server.com/httpdocs/ftp.php on line 30
FTP upload has failed!

Any ideas?
thanks in advance,
regards, P3x
 
Back
Top