Code to image upload for particular record in MSD axapta

You can write following Code to image upload for particular record in axapta. You can this code in job or form. Here Winapi class used to check existence of file,file size. You can upload jpg or jpeg extension image file or you can add other extension like gif bmp etc .

 [handle, filename] = WinAPI::findFirstFile( path) while(filename !='')  
  {  
 if ( WinAPI::fileExists(filenam​e))  
  {  
  [filepath,nameOfFile, extention] = fileNameSplit(filename);  
 if(WinAPI::fileSize(filena​me))  
  {  
  checkFailed("Error Message");  
  return;  
  }  
  if (extention == '.jpg' || extention == '.jpeg')  
 {  
  element.insert();  
  element.showLogo();  
  binData.loadFile(filename)​;  
  imageContainer = binData.getData();  
  }  
  numFileImport++;  
  filename = WinAPI::findNextFile(handl​e);  
 }