2
I am trying to record some images on 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 below:
Warning: move_uploaded_file( 172.23.25.4 manutencao 1415978389.jpg): failed to open stream: Permission denied in /home/Sistemas/celu/public_html/souza/MANUTENCAO/projetos/AD-ipco-Cod-01/fontes/cadastro/cadastro.php on line 126 Warning: move_uploaded_file(): Unable to move '/tmp/phpEQFSvN' to ' 172.23.25.4 maintenance 1415978389.jpg' ... on line 126 Could not upload file, please try again
If I point to the path of the local folder, it works normal, but if I point the path of the folder to another server this error occurs.
I have granted folder and user permissions as per my search.
I created a new test file and now error occurs in the ftp_put() function follows the error
CONNECTED TO THE SERVER 172.23.25.4, WITH THE USER TEST Warning: ftp_put(): Could not create file. in /home/Sistemasinternos/cel/public_html/jbarbin/upload/teste2/ftp_envia.php on line 28 FTP upload has failed!
follows 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);
?>
Check if you have permission to this folder via code, if not, give access to it.
– Tafarel Chicotti
have already given access to folder and same error occurs
– hulckb
you can access this directory via explorer or browser?
– Tafarel Chicotti
I can access normal via explorer and browser ..
– hulckb
By chance, this remote address that I assume can be successfully accessed via network, is a Windows PC? I ask because I had the same problem with the VM in which I use Linux Mint (based on Ubuntu) and while I didn’t edit the fstab by mounting the path of this shared folder (which in my case is an entire partition) I couldn’t even create a new file, let alone upload one.
– Bruno Augusto