0

This is my apex class: Here i have used custom setting object and field.

public with sharing class sample{
public sample(Assetcommunication_Max controller) {}
public string settings{get;set;}
public string vars{get;set;}
Public sample(){
FileFilter__c settings = FileFilter__c.getvalues('Filterextension');
system.debug('name is'+settings.FileType__c);
vars = settings.FileType__c;
  }
}

This is my visualforce code:

 <apex:inputFile value="{!file.versionData}" accept="{!vars}"  fileName="{!file.pathOnClient}" styleClass="slds-button--brand"  onchange="showbutton()" />

In the accept attribute value is not retrieving/accepting from apex class.

| improve this question | | | | |
0

i tried this code , it was working.

public sample(ApexPages.StandardController controller) 
{
}
public string getAcceptFileNames()
{
    FileFilter__c settings = FileFilter__c.getvalues('Filterextension');
    system.debug('name is'+settings.FileType__c);
    string AcceptFileNames = settings.FileType__c;
    return AcceptFileNames;
}

visualforce code:

<apex:inputFile value="{!file.versionData}" accept="{!AcceptFileNames}" fileName="{!file.pathOnClient}" styleClass="slds-button--brand" onchange="showbutton()" />

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.