jeudi 5 avril 2012

Code for uploading image file in table using x++ code

FilenameFilter filter = ['Image Files', '*.bmp;*.jpg;*.gif;*.jpeg'];
    BinData binData = new BinData();
    str extest, filepath, nameofFile;
    ;
    super();
    imageFilePathName = WinAPI::getOpenFileName(element.hWnd(),filter,'',"abc");
    if(imageFilePathName && WinAPI::fileExists(imageFilePathName))
    {
        [filepath, nameOfFile,extest] = fileNameSplit(imageFilePathName);
        if(extest== '.bmp' ||      extest== '.jpg' ||        extest== '.gif' ||          extest== '.jpeg')
        {
            bindata.loadFile(imageFilePathName);
            imageContainer = bindata.getData();
           TestTable.Image =imageContainer;
           TestTable.write();
        }
        else
        {
            throw error("Error in uploading");
        }
    }

Aucun commentaire:

Enregistrer un commentaire