• Raj.....
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies

I am doing a project. where i need to get values using lookup.

The object and the controller are custom. I want to take value to the visualforce page from controller.

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?