You need to sign in to do that
Don't have an account?

Is it possible to read content of a text file with VisualForce
Hi Everyone,
I have a text file that is uploaded by the user,
Using the Document class,
How can i read the content of that text file,
ex: Name, address, email, ...etc,
I want to save those paramters to an object i have created,
Is it possible to open and read an uploaded text file with VisualForce or Apex?
Thanks
You can store the result in list string array and loop through it to check whether the line start with "Name", "address" etc.
You can use class local varibales to store this data and display on VF page
All Answers
I don't believe you can do this with Visualforce. In Apex, you should be able to load the text document as a blob then use the toString method on it.
I'm not 100% sure this is the complete correct syntax but should be a good start.
Ok, please correct me if I’m wrong,
I can create an Apex Class that reads the text document,
And pass the document from The VF to the class,
And then the class will pass back the information I want,
Is that correct?
Best
Well the text file is uploaded using VF,
But instaed of saving the text file,
i want to read information from the text file,
And only save that information to an object,
Is this possible?
Best
The document might differ,
But mainaily i would be looking at specific locations,
And they are seprated by line,
Best
You can store the result in list string array and loop through it to check whether the line start with "Name", "address" etc.
You can use class local varibales to store this data and display on VF page
Great, thanks,
I appreciate everyones help,
Best
Do you have a url or an example,
That does what you just described?
Thanks