What's wrong with this code ?
LoadPicture(empid,filename)
//Set imgfile=%request.MimeData("FileStream",1).FileName
Set imgfile=##class(%FileBinaryStream).%New()
//Do imgfile.Open("RU") ; same flags as OPEN command--use "U" for streams
; now open a Person object containing a Memo stream
; it does not matter what kind of stream Memo is...
//set filename="c:\benedito.jpg"
Set emp=##class(ECOM.Empregado).%OpenId(empid)
set imgfile.Filename = filename
write "alert('Image file Size : "_imgfile.Size_"');",!
; copy the file into Memo
set rf=emp.Foto.CopyFrom(imgfile)
w "alert('ReadFile:"_filename_"--"_rf_"');",!
set ss=emp.Foto.SaveStream()
w "alert('SaveStream:"_ss_"');",!
; save the person object and close it
set sc=emp.%Save()
w "alert('Size:"_emp.Foto.Size_"');",!
w "alert('Status:"_sc_"');",!
Do emp.%Close()
; close the file
Do imgfile.%Close()