How to save file/image at some specific folder.
Hi Team,
I want to save image/file using inter system iris web api.
I am sending file as Base64 formate in JSON object to api .and I want to save it at D/Images folder.
please refer below code that i was tried.
Obj.OrganizationLogoBase64--> has base64 value of image
Set decode = $System.Encryption.Base64Decode(Obj.OrganizationLogoBase64)
set file = ##class(%Stream.GlobalBinary).%New()
do file.Write(decode)
Hi Vivek,
I would suggest using %Stream.FileBinary and then using the LinkToFile method:
Hi Peter,
Thanks but above solution is not working.
Set Obj.OrganizationLogo="abc.png"
in JSON
Have you checked the error codes? Is the file being created?
File is not created and also not getting any error message
Are you testing this through terminal or your web API? If you are testing through your web API you will need to log the status codes instead of writing them
Also, I am not sure what the rest of the code looks like, but it will also need to be saved:
Thanks Peter,
Now it is working fine..
Hi Peter
Can you please help me on how to set status when some error occurs for below statement.
$system.Status.GetErrorText(sc)
I have tried below code but it is not working
You can just check $$$ISERR(sc) directly here, you do not need to run it through $system.Status.GetErrorText(sc) first.
$$$ISERR(status) will compile into ('status). In the case where sc=1, status will become = "". This means that 'status will evaluate to true when sc=1, which means it will think there is an error when there is not.
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue