function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raj.....Raj..... 

browse and view file.

I got this code from internet.

 

<apex:page controller="FileManager ">
    <apex:form >
            <apex:inputFile value="{!file}" />
        <apex:commandbutton action="{!go}" value="go"/>
    </apex:form>
</apex:page>

 

public class FileManager 
{
    public PageReference go() {
        return null;
    }


    public Blob file { get; set; }

    public PageReference submit() 
    {
        ContentVersion v = new ContentVersion();
        v.versionData = file;
        v.title = 'from VF';
        v.pathOnClient ='/foo.txt';
        insert v;
        return new PageReference('/' + v.id);
    }

}

 

I dont know how the code works? How can i know that location of the file which is uploaded?

Code for retrieving the uploaded file?

 

 

super developersuper developer

You view your  file in salesforce CRM content.

 

You can do this with documents also. 

Raj.....Raj.....

sir,

     

       since im new to salesforce,can you please explain in detail..?

super developersuper developer

<apex:page controller="FileManager ">
    <apex:form >
            <apex:inputFile value="{!file}" />
        <apex:commandbutton action="{!go}" value="go"/>
    </apex:form>
</apex:page>

public class FileManager
{
    public PageReference go() {
        return null;
    }


    public Blob file { get; set; }

    public PageReference submit()
    {
        Document v = new document();

        v.body = file;
        v.name = 'From VF';
       insert v;
        return new PageReference('/' + v.id);
    }

}

 

Do this you can find the file in documents tab

 

it will be stored under documents.

 

If you want before you can see it in Salesforce crm content. To see these you need to do some stting regarding content. then only you will be able to see content data.