Borrado de archivo adjunto

Tags: #<Tag:0x00007efffee14650>

He añadido la extensión para adjuntar documento en el envío y realizado las modificaciones en el fichero de configuración. Todo funciona bien pero al cabo de uno o dos días tengo que volver a cargar el archivo adjunto porque ha desaparecido. Sospecho que es una acción del hosting para evitar el envío de adjunto ¿Alguien me puede indicar si mi sospecha está justificada o puede deberse a otra causa?

@aruiz What is the value for $attachment_repository in config.php? Ensure that it is not a temporary directory, as that might be emptied by the system periodically.

$attachment_repository = ‘/tmp’;

Thanks for your reply

Yes. The directory seems temporary

@aruiz To avoid the attachment files being deleted by the system you should create a new directory that is writeable by the web server process.

Thanks Ducan

The current code is:
$ attachment_repository = ‘/ tmp’;

I have to create a directory, for example: uploadocs

$ attachment_repository = ‘/ uploadocs’;

and apply read permissions to directory 775

PHPLIST informs me: “Attachment repository does not exist or is write protected”

What am I doing wrong?

@aruiz The permissions might not be correct, depending on which user under which the web server process runs. Usually the web server runs as www-data or apache but if you are on shared hosting then it might be running as your user.
Or try changing the owner or group of the directory to the web server user.

It is a shared hosting.

The username is predefined by the provider (IONOS) and cannot be changed. Additional users cannot be configured.

@aruiz OK, in that case the path is probably not correct. I expect that the directory uploadocs will be relative to your home directory, you need to enter the full path to the directory. See https://www.ionos.co.uk/help/hosting/using-php-for-web-projects/finding-the-absolute-path-document-root/

1 Like

Resolved!

Not putting the absolute path is the error

Thank you very much for your help