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
madhu l 1madhu l 1 

please find this error




[Error] Error: Compile Error: Method does not exist or incorrect signature: ApexPages.Upload(ApexPages.Message) at line 17 column 21



public class CountryClub 
{
    public Document imageURL{ get; set; }
    
    public CountryClub()
    {
        imageURL= new Document();
    }
    
    public PageReference Upload() 
    {
           imageURL.AuthorId = UserInfo.getUserId(); 
           imageURL.FolderId = UserInfo.getUserId(); // put it in running user's folder 
             try { 
              insert imageURL; 
               } catch (DMLException e) { 
                    ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file')); 
              }    
            //Add more logic here
        return null;
   }

    public PageReference Browse() 
    {
          imageURL.AuthorId = UserInfo.getUserId(); 
          imageURL.FolderId = UserInfo.getUserId(); // put it in running user's folder 
             try { 
              insert imageURL; 
               } catch (DMLException e) { 

               ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
            }
        //Add more logic here
        return null;
    }
}
Neetu_BansalNeetu_Bansal
Hi Madhu,

I found that you have used 'addimage' method for ApexPages, but it is not any method, you have to use 'addMessage' instead, everywhere in your code.

Like instead of:
ApexPages.addimage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file')); 

Use this:
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file')); 

If this help, please mark as best answer so will help others also.

Thanks,
Neetu