+ Start a Discussion
Ashmi PatelAshmi Patel 

Compile Error: Variable does not exist: DocumentUtil

i got this error need help...
Here is the Apex Class

public class FileUploadController{
public Document document {get; set;}
public String url {get; set;}
public boolean hasImage {get; set;}
public static final String hasImage;
public static final String document;

public static void FileUpload()
        hasImage = false;
        document = new document();

public PageReference doUpload()
if (document.body != null)
     System.debug('@@@@@@@@ document:' + document.name);
     if (document.name != null)
         System.debug('@@@@@@@@ doSave');
         Document d = document;
         System.debug('@@@@@@@@ document name: '+d.name);
         d.folderid = UserInfo.getUserId(); //store in Personal Documents
         System.debug('@@@@@@@@ document folder id: '+d.folderid);
         d.IsPublic = true;
            insert d;
            url = DocumentUtil.getInstance().getURL(d);
            hasImage = true;
        catch (Exception e)
            url = '';
        d.body = null;
        System.debug('@@@@@@@@ document object id: '+d.id);
        String url = DocumentUtil.getInstance(d).getURL();
        System.debug('######## document content type: '+d.type);
     PageReference page = new PageReference('/apex/FileUpload');
     return page;


/*  static testmethod void testFileUpload()
        FileUpload fu = new FileUpload();
        fu.document.Name = 'test1';
        fu.document.Body = Blob.valueOf('test1');
    } */


Shun KosakaShun Kosaka
I guess DocumentUtil is not standard class. Create a class named DocumentUtil in your org by below code.
Ashmi PatelAshmi Patel
Compile Error: Variable does not exist: SiteImageBrowser.isImage
got this error
Shun KosakaShun Kosaka

There seem to be other dependencies.

1. Remove getURL and getURL(d) method from DocumentUtil
2. Create new classes clsConstants and ImageFile from above resource. (modify boolean value depending on your org and remove testmethod from ImageFile)
3. Create new class SiteImageBrowser without consturctor and testmethod (to line 7 and } )
4. Paste getURL and getURL(d) method again in DocumentUtil (modify instance like na6 or cs1 depending on your org)
5. Paste constructor in SiteImageBroser class
6. Rename String hasImage and Document from FileUploadController because they duplicates name of other boolean variable
7. Rename "public static void FileUpload()" to "public FileUploadController()"

Ashmi PatelAshmi Patel
thnkuu @ shun kosaka
but i did not get uh