Analogly to reading an image you can also write the image.
Use Core.storeFileDocumentContent https://apidocs.rnd.mendix.com/8/runtime/com/mendix/core/Core.html#storeFileDocumentContent(com.mendix.systemwideinterfaces.core.IContext,com.mendix.systemwideinterfaces.core.IMendixObject,java.io.InputStream)
Hope this helps,
Andre
Answer to the comment using the fileoutputstream in pseudo code:
FileOutputStream fos = null;
File file;
try {
file = new File("C:/myfile.txt");
fos = new FileOutputStream(file);
//NOW USE THE FileOutputStream HERE TO WRITE THE FILE/IMAGE
}
catch (IOException ioe) {
ioe.printStackTrace();
}
finally {
try {
if (fos != null)
{
fos.close();
}
}
catch (IOException ioe) {
System.out.println("Error in closing the Stream");
}
}
Hello Samarth Jadhav,
Use this below code to get file in object
FileInputStream fis = new FileInputStream(compressedImage1);
Core.storeFileDocumentContent(getContext(), OriginalImage.getMendixObject(), fis);
After calling javaaction commit the input file object which passed in javaaction.
Thanks.