Forums

Send atachment without storage file [SOLVED]

SHaDoW 01 Feb, 2011
Hi all.
I need to send an email (trough chronoforms) with a file attachment trough upload form, but I don't need to storage this file in my hosting server.
I can send attachments without any problems. But my storage of my hosting server is growing to much.

I searched in forums with no lucky.

Any ideas?

Thanks a lot.
GreyHead 01 Feb, 2011
Hi SHaDoW,

You can delete the file after the email is sent using PHP in the OnSubmit After Email box

Or you could set up a Cron job to remove all the saved files every week or so.

Bob
SHaDoW 01 Feb, 2011
I try to modify PHP in OnSubmit.

Thanks a lot.
SHaDoW 07 Feb, 2011
Hi all.

I follow the tip of GreyHead and really works.

I post the code for future references.

Paste this code on:
Form Management -> Enter in your form -> Form Code -> On submit code - after sending email


<?php

$ruta = '/path/to/the/folder/*';
$arxiu = glob($ruta);
array_map('unlink', $arxiu);

?>


Obviously this code isn't perfect, but works.

This code remove all content of the folder after sending an email with attachment.

Thats all.

Thanks a lot. See you.
amorino 30 Jan, 2012
Hello,
it works like a charm and so it lets the server empty.

Best regards
Amorino
This topic is locked and no more replies can be posted.