Creating mkdir folder via PHP is not accessible via FTP

Asked

Viewed 48 times

0

I am on an Apache/2.2.22 (Debian) server, and when creating an image upload folder for example the folder is totally inaccessible via FTP. No way to delete or even enter the folder.

$folder_name = 'pasta/date/arquivos/';

mkdir($folder_name, 0775, true);

copy('http://exeplo/img.jpg', $folder_name.'img_name.jpg');
  • It may be permission of the user who created the folder, give a ls -all and see the owner user of the folder.

1 answer

0

You are creating the folder with mkdir on a linux server, probably the permissions come locked.

Create the folder with ftp_mkdir, so you can define the user you can open, and use it to access with some client like filezila:

$dir = 'pasta';
$conn = ftp_connect('ft.seuhost.com');
$rs = ftp_login($conn, 'usuario_ftp', 'senha_do_usuario');
if (ftp_mkdir($conn, $dir)) {
    //ok
} else {
   //Erro
}
ftp_close($conn);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.