Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
HOWTO from Byte Array to Original Image Conversion?
André Asantos
Ranch Hand
Posts: 234
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
HOWTO from Byte Array to Original Image Conversion?
Why this below does not work?
public String execute() throws IOException, FileNotFoundException, FileUploadException, SizeLimitExceededException { if (imagemDoUsuario != null) { if (imagemDoUsuarioContentType.startsWith("image")) { if(imagemDoUsuario.length() < 2097152) { FileInputStream in = new FileInputStream(imagemDoUsuario); byte[] buffer = new byte[(int)imagemDoUsuario.length()]; OutputStream outputStream = null; InputStream inputStream = null; int readBytes; while ((readBytes = inputStream.read(buffer, 0 , 10000))!=-1){ outputStream.write(buffer, 0, readBytes); } in.read(buffer); pessoaImagem.setImagem(buffer); pessoaImagemDAO.salvarPessoaImagem(pessoaImagem); inputStream.close(); outputStream.close(); return populaTodasImagens(); } else throw new SizeLimitExceededException("A imagem anexada ultrapassa o tamanho máximo permitido!"); } else System.out.println("O formato do arquivo é inválido! Não é uma imagem!"); } System.out.println("É preciso apontar o arquivo a ser importado!"); return INPUT; }
André Asantos
Ranch Hand
Posts: 234
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
any clue?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Inserting Image into Oracle.
FileUpload - Very difficult to import a image file
File upload use Struts2, File class
InputStream to RandomAccessFile..best way?
Populate many images from a Blob to a .JSP
More...