473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

images, writing over url connection

Hello, pretty new to java so bear with me.

I am trying to write an image over an HttpURLConnection.

I have an example of how to write text but I am having real problems trying
to write an image, just can't get my head around it.

I have succeeded in writing to the local HD using ImageIO:
//start image output
FileOutputStream fo = new FileOutputStream("myImg.jpg");
BufferedOutputStream bo = new BufferedOutputStream(fo);
ImageIO.write(destination, "jpeg", bo);
bo.close();
//end image output

This works a treat. I understand how to set up an url connection and then
write text to it:

//start text to url
URL url = new URL( "http://www.myurl.com/myfolder/aFile.cfm" );
HttpURLConnection urlcon = (HttpURLConnection) url.openConnection( );

urlcon.setRequestMethod("POST");
urlcon.setRequestProperty("Content-type",
"application/x-www-form-urlencoded");
//image/jpeg

urlcon.setDoOutput(true);
urlcon.setDoInput(true);

PrintWriter pout = new PrintWriter( new
OutputStreamWriter(urlcon.getOutputStream( ), "8859_1"), true );

pout.print( formData );//form data collected from app
pout.flush( );
// end text to url

What I am having a problem with is this bit:
PrintWriter pout = new PrintWriter( new
OutputStreamWriter(urlcon.getOutputStream( ), "8859_1"), true );

Where I want to put in my buffered output stream, and then use that with
ImageIO, I just can't see where I am supposed to start.... or have I missed
the boat entirely

Thanks for taking the time to read this post.
cheers
Martin

Thanks for your time
--

---------------
http://www.nonstoploop.co.uk/ - dynamic websites
http://www.rossanobacchin.be/ - fine art
http://www.weycameras.co.uk/ - photographic supplies
---------------

Jul 17 '05 #1
0 2151

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jim | last post by:
I know this is a little off-topic for C#, but I'm writing my user controls with C#, and the other more HTML-related groups looked like there hasn't been activity in days for some reason......
0
by: Øyvind Isaksen | last post by:
I need to make a page that shows the "top 1" article in a spesific category, with pictures stored in another table. If I just should display the article, I would use a datareader and bind title,...
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
3
by: CLEAR-RCIC | last post by:
I have several images i want to display in an ASP.Net application. The images are being passed to me in binary format from another application. Is there a good way to write them directly to an...
7
by: Sirplaya | last post by:
I am retrieving images that I stored in SQL Server on my web pages in C#. I have no problem with the images displaying, however, I am trying to wrap the image with an <A HREF ..." and each time I...
0
by: etnaelk | last post by:
Hi all, I have a real bugger of a problem that I just haven't been able to figure out. I am working on writing my own proxy server in C# using TcpListener, TcpClient, HttpWebRequest/Response and...
8
by: Frank Millman | last post by:
Hi all This is not strictly a Python question, but as the system to which relates is written in Python, hopefully it is not too off-topic. I have an accounting/business application, written in...
1
by: pompair | last post by:
Hi, Could someone give a pointer how to import couple of hundred images into Sql Server 2005 Express Edition database? Is there a tool for it? Can it be done with Sql Management Studio or is...
2
by: Marco Pais | last post by:
Hi there. I'm developing a small application that uses Web Services to access database and store data. At some point, I store some images, by inserting the absolute image path into a varchar...
4
by: cronusf | last post by:
Hello, I have a program that renders an animation. I would like the program to be able to save this animation to a popular video file. Is there a .NET API for doing this? I looked into...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.