In dynamics Ax 2012, You can read image from physical path and stored in database as follow
BinData binData = new BinData();
str extention, path, nameOfFile;
container imageContainer;
str imageFilePathName;
imageFilePathName=”C:\\abc\\ali.jpg”;
// if ( WinAPI::fileExists(imageFilePathName))
{
binData.loadFile(imageFilePathName);
imageContainer = binData.getData();
table.Person = _Party.RecId;
table.Image = imageContainer;
table.insert();
}
This code runs both for server side and client side. At server side execution table use winserverapi::FileExists
Comments
Post a Comment