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
Srini NandhiSrini Nandhi 

Attachments File Name in Visual force page & Controller

how can i get selected file name (forcecom_workbook.pdf) as attachment file name. Please find below image to get file name in textbox. and need to get the size in MBs instedad of bytes.
User-added image
rajesh gandirajesh gandi
I think Document Rules will be same here also .
Document Rules
1)You can upload documents that have file names of up to 255 characters 
including the extension. 
2)The size limit for any document you upload is 5 MB. 
The maximum size for a custom-app logo is 20 KB.

<apex:inputFile value="{!contract.body}" fileName="{!contractName}"/>

public String contractName {get;set;}
public Attachment
  get {
      if (contract == null) {
            contract = new Attachment();
      return contract;

You neeed more information go to this url its useful

Please select this answer is useful you