You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Julien Martin <ba...@gmail.com> on 2006/01/24 15:26:53 UTC

File upload with ADF not working

 Hello,

I am trying to get "af:inputFile" to work. It does not upload any file
in the directory I specified here:

<context-param>
    <!-- directory to store temporary files  -->
    <param-name>oracle.adf.view.faces.UPLOAD_TEMP_DIR</param-name>
    <!-- Use an ADFUploads subdirectory of /tmp -->
    <param-value>c:\tmp\</param-value>
</context-param>


I am trying to run the ADF sample jsp from "adf-faces-demo" from here:
"adf-faces-demo\components\inputFile.jspx"


Any help welcome,

Julien.

Re: File upload with ADF not working

Posted by Julien Martin <ba...@gmail.com>.
thanks a lot hans,
I got it to work with the following code:

try {
            InputStream is = file.getInputStream();
            OutputStream outputStream = new FileOutputStream("c:\\" +
file.getFilename());
            int data;
            while((data=is.read()) != -1){
                outputStream.write(data);
            }

            is.close();
            outputStream.close();

            } catch (IOException ex) {
                ex.printStackTrace();
            }

Re: File upload with ADF not working

Posted by Hansjörg Meuschel <hj...@gmx.de>.
Hi Julien,
the specified directory is a tempdir, which might be used to temporarily 
store large files only. The usual manner to retrieve a file is via a 
value binding in a bean.
look at 
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/devguide/fileUpload.html 

in your bean, you need a

UploadedFile file

with getters and setters..
To get further in this, try to put a debug point into the setter of the 
file in your bean...

Regards,
Hans


Julien Martin wrote:

>Thanks but it is still not working with the added library. What is
>more it is not returning me any error or exception. It simply tells me
>the file was uploaded whereas this is not the case.
>Any other idea?
>Julien.
>
>  
>

Re: File upload with ADF not working

Posted by Julien Martin <ba...@gmail.com>.
Thanks but it is still not working with the added library. What is
more it is not returning me any error or exception. It simply tells me
the file was uploaded whereas this is not the case.
Any other idea?
Julien.

Re: File upload with ADF not working

Posted by Hansjörg Meuschel <hj...@gmx.de>.
Hi,
you probably have to copy the apache commons fileupload jar into your 
application - available from apache org ...
Julien Martin wrote:

> Hello,
>
>I am trying to get "af:inputFile" to work. It does not upload any file
>in the directory I specified here:
>
><context-param>
>    <!-- directory to store temporary files  -->
>    <param-name>oracle.adf.view.faces.UPLOAD_TEMP_DIR</param-name>
>    <!-- Use an ADFUploads subdirectory of /tmp -->
>    <param-value>c:\tmp\</param-value>
></context-param>
>
>
>I am trying to run the ADF sample jsp from "adf-faces-demo" from here:
>"adf-faces-demo\components\inputFile.jspx"
>
>
>Any help welcome,
>
>Julien.
>  
>