Hi there.
Im using the latest version of Chronoforms, thanks for creating this great plugin.
I searched the forum for solutions to my issue, but every solution i tryed didnt solve my problem.
I'm searching for the peace of php code to put in the event to delete the files uploaded after they are send to the email adress given.
Hope somebody could help me out.
T
Im using the latest version of Chronoforms, thanks for creating this great plugin.
I searched the forum for solutions to my issue, but every solution i tryed didnt solve my problem.
I'm searching for the peace of php code to put in the event to delete the files uploaded after they are send to the email adress given.
Hope somebody could help me out.
T
<?php
$ruta = '/path/to/the/folder/*';
$arxiu = glob($ruta);
array_map('unlink', $arxiu);
?>
replaced path for my path.....but didnt work
Errror:
Language string failed to load: invalid_address: qweqwe
Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/tvscreen/domains/xxxxxxxxx.com/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(18) : eval()'d code on line 5
Thank you for sending in your arrival form!
$ruta = '/path/to/the/folder/*';
$arxiu = glob($ruta);
array_map('unlink', $arxiu);
?>
replaced path for my path.....but didnt work
Errror:
Language string failed to load: invalid_address: qweqwe
Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/tvscreen/domains/xxxxxxxxx.com/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(18) : eval()'d code on line 5
Thank you for sending in your arrival form!
Hi Fection,
It looks to me as though the code is working OK but the path goes to an empty folder. Please check that you have the complete path there.
Bob
It looks to me as though the code is working OK but the path goes to an empty folder. Please check that you have the complete path there.
Bob
Thank you Greyhead.
Can i use this one? : JOOMLA_PATH/components/com_chronoforms/uploads/FORM_NAME/
Or do you suggest using the core path
Can i use this one? : JOOMLA_PATH/components/com_chronoforms/uploads/FORM_NAME/
Or do you suggest using the core path
I tryed , and now the this error comes up:
Warning: unlink(components/com_chronoforms/uploads/Arrival/) [function.unlink]: Is a directory in /home/tvscreen/domains/mywebsiteadress.nl/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(18) : eval()'d code on line 5
Warning: unlink(components/com_chronoforms/uploads/Arrival/) [function.unlink]: Is a directory in /home/tvscreen/domains/mywebsiteadress.nl/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(18) : eval()'d code on line 5
I know you probably very busy but i hope you find the problem .... im stuck at the moment and cant continue with my project.
Hi fection,
That isn't an 'Error' it's a PHP 'Warning' (that something *might* be wrong). Do the files get deleted?
Bob
That isn't an 'Error' it's a PHP 'Warning' (that something *might* be wrong). Do the files get deleted?
Bob
Hi fection,
I tried Googling 'Warning: unlink' and the most common answer seems to be that the Joomla! User (or the FTP User if FTP is enabled for your site) doesn't have delete permission for this folder.
Bob
I tried Googling 'Warning: unlink' and the most common answer seems to be that the Joomla! User (or the FTP User if FTP is enabled for your site) doesn't have delete permission for this folder.
Bob
But i chmodded the folder the right way.
And ftp is enabled, it CAN delete components and modules folders on uninstall.
So it should have the right permission right?
And ftp is enabled, it CAN delete components and modules folders on uninstall.
So it should have the right permission right?
Hi fection,
It *should* indeed. But it's not able to delete your files so maybe it hasn't ???
Bob
It *should* indeed. But it's not able to delete your files so maybe it hasn't ???
Bob
Hi fection & Bob,
Your code is actually trying to remove the directory containing the uploaded files. This is most likely because your glob()-search will also return a reference to any directories matching the pattern, not just files.
In this case, you've probably forgotten to add the asterisk (*) at the end of the pattern, so you are actually matching against the directory itself, not files within the directory.
Further, unlink can only delete files (you'll have to use rmdir to remove an empty directory), and hence you get the warning "Is directory".
Re-check your glob-pattern, and considder adding tests to determine that it's a file and not a directory (to remove the warnings:
/Fredrik
Your code is actually trying to remove the directory containing the uploaded files. This is most likely because your glob()-search will also return a reference to any directories matching the pattern, not just files.
In this case, you've probably forgotten to add the asterisk (*) at the end of the pattern, so you are actually matching against the directory itself, not files within the directory.
Further, unlink can only delete files (you'll have to use rmdir to remove an empty directory), and hence you get the warning "Is directory".
Re-check your glob-pattern, and considder adding tests to determine that it's a file and not a directory (to remove the warnings:
$files = glob(JPATH_ADMINISTRATOR . DS . "components/com_chronoforms/uploads/Arrival/*");
foreach ($files as $k => $v)
{
if (is_file($v))
{
unlink($v);
}
}
/Fredrik
This topic is locked and no more replies can be posted.