Hi
I use upload field with upload path:
/home/public_html/dev/images/members/
This works fine.
Now I want CF to add a directory for each user uplaoding files:
/home/public_html/dev/images/members/{user:username}
But this is not working. I get
Destination directory not available.
How can I make CF to create such directories?
Thanks.
Patrick
CF 6.1.2
I use upload field with upload path:
/home/public_html/dev/images/members/
This works fine.
Now I want CF to add a directory for each user uplaoding files:
/home/public_html/dev/images/members/{user:username}
But this is not working. I get
Destination directory not available.
How can I make CF to create such directories?
Thanks.
Patrick
CF 6.1.2
HI Patrick.
It should work OK I think. Please check the permissions for the /members/ folder and check that the Joomla user has write permission there. That is the most likely cause.
Do you see anything useful in the Debugger output?
Bob
It should work OK I think. Please check the permissions for the /members/ folder and check that the Joomla user has write permission there. That is the most likely cause.
Do you see anything useful in the Debugger output?
Bob
Hello Bob
CF does give the path including user directory:

Username is "test1".
But directory is not created on server. Directory "zertifizierung" has chmod 777.
and check that the Joomla user has write permission there
How can I do this? It's not only one user uploading, there are many users supposed to upload files.
Thanks.
Patrick.
CF does give the path including user directory:

Username is "test1".
But directory is not created on server. Directory "zertifizierung" has chmod 777.
and check that the Joomla user has write permission there
How can I do this? It's not only one user uploading, there are many users supposed to upload files.
Thanks.
Patrick.
Hi Patrick,
The permission question isn't about the form users - it's a question about the server setup. Can Joomla! create new folders . . . you may need to check with your host for the exact settings.
Bob
The permission question isn't about the form users - it's a question about the server setup. Can Joomla! create new folders . . . you may need to check with your host for the exact settings.
Bob
Pretty sure you will need to use PHP to create the folder first, and since people can use certain special characters in usernames it might be a bad idea - user ID would be better
Hi Patrick,
There is a FAQ here with the code for CFv4 and CFv5 - it should be possible to adapt the CFv5 code for CFv6.
Bob
There is a FAQ here with the code for CFv4 and CFv5 - it should be possible to adapt the CFv5 code for CFv6.
Bob
@healyhatman
Thanks for the hint. I'll use user ID.
@Bob
I can install extensions without any problems. There shouldn't be permission problems.
Thanks for the link to the code. This gave me a good start.
I've put together following code and execute it before the upload action:
And my setting in Upload directory path looks like this:
This works fine.
Patrick
Thanks for the hint. I'll use user ID.
@Bob
I can install extensions without any problems. There shouldn't be permission problems.
Thanks for the link to the code. This gave me a good start.
I've put together following code and execute it before the upload action:
<?php
$jid = JFactory::getUser()->id;
$directoryPath = $_SERVER['DOCUMENT_ROOT'] . "/images/mitglieder/zertifizierung/";
if($jid > 0) {
$directoryName = $jid;
}
else {
$directoryName = "guests";
}
if(!is_dir($directoryPath.$directoryName)){
mkdir($directoryPath.$directoryName, 0755);
}
return $this->data("userdir", $directoryName, true);
?>
And my setting in Upload directory path looks like this:
{path:root}/images/mitglieder/zertifizierung/{data:userdir}
This works fine.
Patrick
This topic is locked and no more replies can be posted.