File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
I/O and Streams
Save Image into different domain
Joined: Mar 26, 2005
Sep 13, 2011 02:30:00
I have one function to upload an image.
I need to save image into different domain.
So when client call my API, pass in the photo as multipart type, then I need to save it into different domain.
Does my code below Workable? I mean will it save into the stat.abc.com/userpt/ OR will hit error ?
Note: below piece of code running in app.abc.com domain. But both domains are in the same server.
String fullImagePath = "http://stat.abc.com/userpt/photoExample.jpg"; ByteArrayInputStream bis = new ByteArrayInputStream(photo); Object source = bis; // File or InputStream, it seems file is OK ImageInputStream iis = ImageIO.createImageInputStream(source); BufferedImage bi = ImageIO.read(iis); // retrieve image File outputfile = new File(fullImagePath); ImageIO.write(bi, photoType, outputfile);
Diploma in Computer Studies
Formula 1 app by Maxis (Playbook)
Joined: Mar 22, 2005
Sep 13, 2011 02:53:49
Code doesn't run on a "domain", it runs on a computer - a server apparently in your case. Whether files can be saved in some other directory on the same computer is a question of permissions.
What will definitely not work is using an "http" file name. You need to translate that into an actual directory name.
Ping & DNS
- my free Android networking tools app
subject: Save Image into different domain
Convert image to byte and viceversa
Writing Image onto a WordDoc
need help with ImageInputStream types
Using Eclipse SWT Image, JDBC SQLite and JAVA to insert, store and retrieve Images.
how to create an image through bufferedimage,image and other helper class using byte array
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014