Hi,
In this post we will see how to upload and download images in Oracle ADF application.
Note: this example does not store images in BLOB column it just copy the image from client machine to server directory.
Download the sample workspace
Happy JDeveloping,
Zeeshan Baig
What about reading and writing images to blob and showing it on page like in this app?
ReplyDeleteHi Boris,
ReplyDeleteThis will be coming soon.
Hi,
ReplyDeleteReading and writing images from Blob http://baigsorcl.blogspot.com/2010/09/store-images-in-blob-in-oracle-adf.html
Hi Baig
ReplyDeleteThanks for your clear demonstration. I have a question, I have my weblogic running as standalone server and I don't use Jdeveloper to run my application. I can upload the images and they successfully upload to a folder(As I can see them at the time I uploaded in the folder); however, I should restart my server in order to see them in my web application!. I'm not sure what the problem is, and it seems weird. do you know where I have done wrong?
cheers
@khash.
ReplyDeleteI am not sure what is the issue make sure the you have set the partial submit to true and partial triggers on image component.
Hi,
ReplyDeleteI am working on an application, where the user can upload their pic and that pic will be downloaded to blob column of the table. Before it add to the column i want this pic to be displayed as soon as the user upload this. What should i mention at af:image source property? I am actually giving expression of a outputstream variable from a bean but this not helping. Any suggestions?
Check this entry http://baigsorcl.blogspot.com/2010/09/store-images-in-blob-in-oracle-adf.html
ReplyDeletedoing the same thing as you want.
hi ....the image is not stored in the server location ....but it is alerady displaed in the image componant ....i dont know how this happen ?...
ReplyDeleteHi Tokando,
ReplyDeleteThe file saves in your integrated server directory. i have explained in the video
okay Zeeshan it is saved but if you try to run the application again the saved files is automatically deleted .
ReplyDeleteiam using jdeveloper r2....
Thank you!! This video had been very usefull for me!! but while i tried the same in jsff i am getting error as NullPointerException in
ReplyDeleteprivate BlobDomain createBlobDomain(UploadedFile file) {
InputStream in = null;
BlobDomain blobDomain = null;
OutputStream out = null;
try {
in = file.getInputStream(); //Null Pointer Exception
This vido is very help full for me but Please tell some thing about storing and streaming video using adf
ReplyDeleteHi Naeem the process should be similar. You can store videos in BLOB column.
ReplyDeleteUse af:media to play video files instead of af:image check this link http://www.baigzeeshan.com/2010/11/how-to-display-videos-in-adf-fusion.html
ZB
hi Zeeshan your post work at integrated weblogic ..but i tried it after deploy my application in standalone weblogic server ..the image not displayed ...can you tell me what is wrong ....
ReplyDeleteHi Tokando,
ReplyDeleteSorry for late response being busy for last few weeks...anyways
Which path are you using in your code? can you share any example.
ZB
Hi Zeeshan,
ReplyDeleteI am having a problem with the "Employeeid" attribute binding.
The getCurrentEmployeeId() method is always giving me the employee id of the 1st employee...
Can you give a hint about what the problem might be ?
Thanks in Advance.
Hi Neo,
ReplyDeleteWhat code are you using to retrieve Id? try using reading from Iterator like
DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("testIterator");
String attribute = (String)iterBind.getCurrentRow().getAttribute("field1");
Check this page for more handy code http://biemond.blogspot.com/2009/03/some-handy-code-for-backing-beans-adf.html
Hope it help,
ZB
For this we have to create Data Source in weblogic connsol???
ReplyDeleteHi,
DeleteNot only for this if you application uses database then in order to work it you have to create data source in weblogic server (unless you are connecting differently)
ZB
Hi Baig,
ReplyDeleteThanks for the turorial.
I can copy uploaded image files to a server locations now.
But how to copy if the uploaded file is MS words doc or PDF.
Could you please provide the code?
Regards,
Sam
Hi,
DeleteCan you explain your use case in detail. What do you mean by Copy ?
If you want to download a file then the use case is covered in the video.
Zeeshan
Hi Zeeshan,
DeleteMy requirement is to enable user upload MS Office/pdf files (instead of image files) to a specific location in Weblogic server.
From your code I understood how to do the same for image files. But I want the code for MS words/pdf files.
Regards,
Sam
You can follow same steps for WORD and PDF files as well.
DeleteIt depends on client how to open not for server.
ZB
how can i upload and download files using oracle forms
ReplyDeleteCheck this http://www.baigzeeshan.com/2010/02/storing-and-retrieving-images-word.html
DeleteZB
Hi,
ReplyDeleteI downloaded your application and try to run.
GOT THIS error
<_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.ConfigException, msg=JBO-33001: Configuration file /demo/model/services/common/bc4j.xcfg is not found in the classpath.
Hi,
DeleteWhich JDEV version are you using?
ZB
Hi ,
ReplyDeleteThanks for the tutorial.
When i m uploading image, it uploaded successfully but when i m updating image with existing image it doesn't refresh.
For refreshing we have to call reload method of browser.
Is there another way of doing this as i don't want to call reload.
Hi,
Deleteyou can refresh the Image component only by using partial triggers.
Try it
ZB
Hi Zeeshan Baig,
ReplyDeleteI am trying to display images from file system. And, since my application will have to update the images frequently, I am thinking of deploying images in a jar file to WLS console (Shared Library Resource). In this way, when I am updating any image file, I can just re-deploy the images jar file only. Do you have any suggestions as to how this can be implemented? Or is there any other way? Thanks.
Hi,
DeleteSorry for late response. Yes you can do it check this blog http://www.oracle.com/technetwork/developer-tools/adf/learnmore/86-images-from-jar-427953.pdf
thanks for your share.
ReplyDeleteI have downloaded the simple file(HrImageExample.zip). but the sample can't run because the datacontorl(HrAppModuleDataControl) don't exsit in the model.
Could you please check the simple?
Hi,
DeleteCheck your database connection from Jdeveloper. Click the refresh icon in data control palette to verify.
Zeeshan
Hi Zeeshan,
ReplyDeleteThe code is working perfectly except for a small thing, when a picture is uploaded, it is saved in the /images folder under the Integrated weblogic, while the /images folder in the project itself remains empty, as a result the picture is not displayed when running the application....please advice...thanks
Hi,
DeleteYou need to setup web directory on server to store images and configure your application to use that directory using relative path. for example /images/myImage.jpg Google you will find some solutions
Hope it helps
Dear Zeeshan,
ReplyDeleteI am getting following error.
DF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6>
oracle.jbo.ConfigException: JBO-33001: Configuration file /demo/model/services/common/bc4j.xcfg is not found in the classpath.
I am using following JDEV version
Build JDEVADF_12.1.3.0.0_GENERIC_140521.1008.S
Can you please help me to fix this
Sandip Wavhal
Hi,
DeleteCheck this might help https://mjabr.wordpress.com/2012/11/27/how-to-solve-oracle-jbo-configexception-jbo-33001/
Zeeshan
Dear Zeeshan
ReplyDeleteI can't download file. The link is died
Yes Google killed it
DeleteThank Zeeshan
ReplyDeleteI mean an you reupload source code?
I'm building Upload image aplication but error
Thank for your help!
Lang Thang
java.io.FileNotFoundException: (No such file or directory)
java.lang.NullPointerException
at ncs.hcm.view.ImageUploadBean.getCurrentEmpId(ImageUploadBean.java:64)
at ncs.hcm.view.ImageUploadBean.uploadImage(ImageUploadBean.java:100)
at ncs.hcm.view.ImageUploadBean.uploadImageFileAction(ImageUploadBean.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:181)
at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1988)
...more
<_logUnhandledException>
javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1988)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
at org.apache.myfaces.trinidad.component.UIXComponent.broadcastInContext(UIXComponent.java:364)
at org.apache.myfaces.trinidad.component.WrapperEvent.broadcastWrappedEvent(WrapperEvent.java:82)
...more
Caused by: java.lang.NullPointerException
at ncs.hcm.view.ImageUploadBean.uploadImage(ImageUploadBean.java:117)
at ncs.hcm.view.ImageUploadBean.uploadImageFileAction(ImageUploadBean.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:181)
at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
... 68 more
javax.servlet.ServletException
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:663)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
...more
Caused by: java.lang.NullPointerException
at ncs.hcm.view.ImageUploadBean.uploadImage(ImageUploadBean.java:117)
at ncs.hcm.view.ImageUploadBean.uploadImageFileAction(ImageUploadBean.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:181)
at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
... more
It clearly says java.io.FileNotFoundException: (No such file or directory)
Delete