Hi,
Is it possible to remove the uploaded files automaticly from the server after they have been send by email?
I have a form on my website with the possiblity to upload a photo. The result is send by email, but I don't want to keep the photo's on my internetserver. It only takes space...
With kind regards,
Remko Rijpkema
Is it possible to remove the uploaded files automaticly from the server after they have been send by email?
I have a form on my website with the possiblity to upload a photo. The result is send by email, but I don't want to keep the photo's on my internetserver. It only takes space...
With kind regards,
Remko Rijpkema
Thanks!
Before everything worked, I had to modify the upload path (add the folder of the form) and changed the "keep" settings to 60 seconds so I could test it after a minute instead of 7 days.
But the most important things: I learned a littlebit and it works!
Before everything worked, I had to modify the upload path (add the folder of the form) and changed the "keep" settings to 60 seconds so I could test it after a minute instead of 7 days.
But the most important things: I learned a littlebit and it works!
Hi,
I used that specific script and changed the value from 7 to 1 to test it 24 hours later and changed the path according my folder names.
I pasted the script in the code tab of the form.
should i place the script somewhere else?
thx for your feedback
I used that specific script and changed the value from 7 to 1 to test it 24 hours later and changed the path according my folder names.
I pasted the script in the code tab of the form.
<?php
// change the next line to match your upload folder
// Use this version for Joomla! 2.5 or earlier
$files = glob(JPATH_SITE.DS.'components'.DS.'com_chronoforms5'.DS.'uploads'.DS.'*');
// use this version for Joomla! 3 or later
//$files = glob(JPATH_SITE.'/components/com_chronoforms/uploads/*');
// set 'keep' period to 7 days
$checktime = time() - 1 * 24 * 60 * 60;
foreach ( $files as $v ) {
if ( is_file($v) && filemtime($v) < $checktime ) {
unlink($v);
}
}
?>
unfortenately, the files remain on the server after testing 24 hours later.
should i place the script somewhere else?
thx for your feedback
Hi bart,
Here's what the FAQ says:You could either include this as a Custom Code action in your form, in which case the housekeeping will be done each time the form submits; or you could set it up as a scheduled cron job on the server to run every few days.
It might work in the form Code tab but it won't do anything until the form is loaded.
Bob
PS I suggest that you don't' use an email as a UserID here the forums are publicly viewable and the email may be scraped and used for spam. If you PM me I can change it for you.
Here's what the FAQ says:You could either include this as a Custom Code action in your form, in which case the housekeeping will be done each time the form submits; or you could set it up as a scheduled cron job on the server to run every few days.
It might work in the form Code tab but it won't do anything until the form is loaded.
Bob
PS I suggest that you don't' use an email as a UserID here the forums are publicly viewable and the email may be scraped and used for spam. If you PM me I can change it for you.
Hi Greyhead,
i have set it up as a cron job.
i see the logs that the script is running, but the files remain in the directory.
am i doing something wrong?
- hosting the php in specific folder?
- folder or file properties that needs to be changed
- should i use the username of the subdomain or of the mail domain of the website?
PS: even when this is working, how can i make sure that the index.html on the upload folder will not be removed?
i have set it up as a cron job.
i see the logs that the script is running, but the files remain in the directory.
am i doing something wrong?
- hosting the php in specific folder?
- folder or file properties that needs to be changed
- should i use the username of the subdomain or of the mail domain of the website?
PS: even when this is working, how can i make sure that the index.html on the upload folder will not be removed?
HI Remko,
I can only say that the code (or something similar) worked when we developed it. You'll need to debug it to see exactly what the problem is that you are having :-(
You can set up a little test folder and form and execute the code with no time delay to see exactly what is happening.
If you want to leave the index.html file then add a 'if' clause to check for that and don't unset it.
Bob
I can only say that the code (or something similar) worked when we developed it. You'll need to debug it to see exactly what the problem is that you are having :-(
You can set up a little test folder and form and execute the code with no time delay to see exactly what is happening.
If you want to leave the index.html file then add a 'if' clause to check for that and don't unset it.
Bob
got it.
works perfectly.
thx for your support
works perfectly.
thx for your support
This topic is locked and no more replies can be posted.