A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
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
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.
I agree. Here's the link:
subject: Save Image into different domain
Using Eclipse SWT Image, JDBC SQLite and JAVA to insert, store and retrieve Images.
Writing Image onto a WordDoc
Convert image to byte and viceversa
how to create an image through bufferedimage,image and other helper class using byte array
need help with ImageInputStream types
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015