You need to sign in to do that
Don't have an account?
How to get file body using input type file
Hai all,
i have a problem in getting file body using input type="file" name="file" to the controller for insert a attachment
where as i am getting file body directly using
visualforce page:
<apex:inputfile value="{!filebody}" filename="{!filename}"/>
controller:
Attachment myAttachment = new Attachment();
myAttachment.Body = fileBody; //line 1
myAttachment.Name = fileName;
myAttachment.ParentId = CurrentParentId;
insert myAttachment;
but the reason why i am asking only by input type=" file" because i have to upload multiple files(multi attchments) which is not possible using apex:inputfile
like line 1 how can i get file body using input type="file" to the controller
please help me in sloving this problem its bit urgent
This link can help you:
http://bobbuzzard.blogspot.in/2011/01/uploading-multiple-attachments-via.html
in that link it is for selecting individual file selecting but i am trying to select multiple files at a time using
<input type="file" multiple="true" />
using java script i have to send file body to controller
apex:inputFile supports one file at a time.
check this link:
http://salesforce.stackexchange.com/questions/13433/visualforce-inputfile-component-allows-selecting-multiple-files-but-doesnt-uplo
ya anoop your right apex:inputFile only support one file at a time so that is why i am using <input type="file" multiple="true"> for multiple files at a time...
i am able to pass multiple file names and size from visualforce page to controller using javascript but i am getting problem in passing file content
how to get file content into java script when we are using
<input type="file" multiple="true">
I found one link that supports multiple file at a time.
But not sure how they are using
just chek this link:
http://www.tehnrd.com/multi-file-uploader-for-salesforce-oh-ya-and-progress-bars-too/
i am already using that code it is working fine till 1.27 MB but in salesforce standard uploading we are uploading upto 5 MB
so it will not work for larger file like 3 MB
Did you get the solution ?
If yes please help by posting the Solution
Warm Regards
Can please share the code how you are able to pass the file name and size to controller. I am having the same scenaio in which I need to pass two or more than two file content at a time. Please share
Thanks