• Santosh Saha 10
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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

  • August 01, 2013
  • Like
  • 0