En un formulario tengo algo como esto
Código HTML:
Ver original
<h:form enctype="multipart/form-data">
<h:inputFile value="#{mybean.imageSelected}"/>
<h:commandButton value="Change image" action="#{mybean.changeImage()}"/>
</h:form>
en mybean tengo esto:
Código Java:
 Ver original
Variable String imageSelected con sus get/set
public void changeImage()
{
try
{
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}
in.close();
out.close();
}
{}
}
 
 




