Stream .File Binary

I tried to get a image from user . But It did not run. So please solve this problem

Class Quadramed.Chennai Extends %Persistent
{

Property Image As %Stream.FileBinary(LOCATION = "C:/Images");

Method imagefile()
{
obj = ##class(Sam.binary).%New()
"enter your name",img
obj.Image.Write(img)
status = obj.%Save()
}
 

  • -1
  • 0
  • 480
  • 3
  • 2

Answers

Should the user enter the path to the existing image?

Existing image as offline or online :? plz give example of  any path of sample.

This method links stream object to an existing file:

Method imagefile()
{
  set obj = ##class(Sam.binary).%New()
  read "enter path to image: ",img
  set st = obj.Image.LinkToFile(img)
  write $System.Status.GetErrorText(st)
  set st = obj.%Save()
}

1. Notice what Eduard wrote: 

          set st = obj.Image.LinkToFile(img)
 

2. Your class is:

Class Quadramed.Chennai Extends %Persistent

 

and in your imageFile method you have:

obj = ##class(Sam.binary).%New()

maybe this is your problem?

Please give one example program of Stream file Binaryand images are store and retrieve these program. I confused this topics.