how to get file address?

11 months 1 week ago #333569 by saman2
how to get file address? was created by saman2
hi
i have a field to get a file from user in registration. i need use to that file path. how to use substitution or any other way to get that file path?
i use all type of substitution:
[cb:userfield field="cb_madraktahsili" /]
[cb:userdata field="cb_madraktahsili" /]
[cb_madraktahsili]
but no one return to me absolute file path and return to me like this:
mysite.com/cb-profile/fieldclass?field=cb_madraktahsili&function=download&user=2794&reason=profile
also i read this topic  and set right access to this field.
how to get path of file?

Please Log in to join the conversation.

11 months 1 week ago #333572 by krileon
Replied by krileon on topic how to get file address?
We don't return the absolute file path. Database just stores the file name and all other output returns the secured live path to the file (that's the fieldclass URL). You'll need to build the absolute path yourself.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 months 1 day ago - 9 months 3 weeks ago #334029 by saman2
Replied by saman2 on topic how to get file address?
for future user:
if you want understand that a file is change in cb profile or not and do some autoaction, you can use this code in condition tab of auto action and select condition field to Code then use this scope of code:
$var3=$variables[var3];
$var3filename=$var3->cb_madraktahsili;
$var1=$variables[var1];
$var1filename=$var1->cb_madraktahsili;
if($var1=$var3){
echo "true";
}
else{
echo "false";
}
set Operator to "Equal To" or "Not Eqaul To" according your need.
put "true" in the Value field.
also if you want compare multiple field with old value you can use this code: (each of that change,not one of that)
$var3=$variables[var3];
$vararray3 = [$var3->cb_madraktahsili, $var3->cb_ozviatnezam, $var3->cb_parvanehfaliat];
$var1=$variables[var1];
$vararray1 = [$var1->cb_madraktahsili, $var1->cb_ozviatnezam, $var1->cb_parvanehfaliat];

$flag = 'true';
//dump($vararray3,"vararray3");
//dump($vararray1,"vararray1");
foreach($vararray3 as $ind1 => $v1)
{
  if($v1 != $vararray1[$ind1])
  {
    $flag = 'false';
    break;
  }
}
return $flag;
 

Please Log in to join the conversation.

9 months 3 weeks ago #334052 by saman2
Replied by saman2 on topic how to get file address?
hi
i use this to get absolute file address:
https://*************/images/comprofiler/plug_cbfilefield/[user_id]/[var1_cb_madraktahsili]

but htaccess file in the :
https://***********/images/comprofiler/plug_cbfilefield/
deny me to get the file . if i change htaccess file the security of site go to low. is there any way ?
i can not use :
mysite.com/cb-profile/fieldclass?field=cb_madraktahsili&function=download&user=2794&reason=profile
because this want authenticate to joomla but i want send url of image to external application (such as Telegram).

Please Log in to join the conversation.

9 months 3 weeks ago #334053 by krileon
Replied by krileon on topic how to get file address?
Files are intentionally protected by htaccess. They're accessed through PHP to allow access permissions and privacy controls to properly apply. Image fields allow direct access. If you're trying to share an image then use an image field instead of a file field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

9 months 3 weeks ago - 9 months 3 weeks ago #334055 by saman2
Replied by saman2 on topic how to get file address?
Ah... I made a big mistake. If I change the field type from file to image now, what will happen to the users who have uploaded so far? Will previously uploaded files be visible in image format?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.224 seconds

Facebook Twitter LinkedIn