I'm trying to write some images to another server pointing the IP and the folder, in my PHP code I pointed the path of the folder $_UP['pasta'] = '\\172.23.25.4\\manutencao\';
and the following error occurs:
Warning: move_uploaded_file (\ 172.23.25.4 \ maintenance \ 1415978389.jpg): failed to open stream: Permission denied in / home / Systems / celu / public_html / souza / MANUTENCAO / projects / AD-ipco- Warning: move_uploaded_file (): Unable to move '/ tmp / phpEQFSvN' to '\ 172.23.25.4 \ maintenance \ 1415978389.jpg' ... online 126 Could not send the file , try again
Its pointing to the local folder path, it works fine, but if you point the folder path to another server this error occurs.
I granted folder and user permissions according to my search.
I created a new test file and now error occurs in function ftp_put () follows error
CONTAINED IN SERVER 172.23.25.4, WITH THE USER test Warning: ftp_put (): Could not create file. in /home/Internal_Systems/cel/public_html/jbarbin/upload/teste2/ftp_envia.php on line 28 FTP upload has failed!
follow the code
<form action="ftp_envia.php" enctype="multipart/form-data" method="post">
<input name="file" type="file" />
<input name="submit" type="submit" value="Upload File" />
</form>
Below the php code
<?php
ftp_server = "172.23.25.4";
$ftp_user_name = "teste";
$ftp_user_pass = "123456";
$destination_file = "/home/teste";
$source_file = $_FILES['file']['tmp_name'];
$conn_id = ftp_connect($ftp_server);
ftp_pasv($conn_id, true);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name <br>";
exit;
} else {
echo "CONETADO NO SERVIDOR $ftp_server, COM O USUARIO $ftp_user_name";
}
ftp_pasv($conn_id, true);
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII);
// check upload status
if (!$upload) {
echo "<br>FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_close($conn_id);
?>