Image writing over URLConnection
Hello, I am trying to write an image over an HttpURLConnection.
I know how to write text but I am having real problems trying
to write an image
I have succeeded in writing to the local HD using ImageIO:
But I am trying to write Image by ImageIO on url and failed
URL url = new URL(uploadURL);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
output = new DataOutputStream(connection.getOutputStream());
output.writeBytes("--" + boundary + "\r\n");
output.writeBytes("Content-Disposition: form-data; name=\"" + FIELD_NAME +
"\"; filename=\"" + fileName + "\"\r\n");
output.writeBytes("Content-Type: " + dataMimeType + "\r\n");
output.writeBytes("Content-Transfer-Encoding: binary\r\n\r\n");
ImageIO.write(image, imageType, output);
the uploadURL is the url to an asp page on the server which will upload the image with the file name given in "content-Disposition: part.
now when I send this then asp page find the request and find the name of file. but does not find the file to be uploaded.
The problem is that when writing by ImageIO on URL what will the name of the file on which the ImageIO is writing,
So please help me how ImageIO will write an image on URLConnection and how can I know the name of the file which I have to use in the asp page to upload the file
Thanks for taking the time to read this post
Dilip Agarwal
Thanks for your time
View Answers
Related Tutorials/Questions & Answers:
Image writing over URLConnectionImage writing over URLConnection Hello, I am trying to write an
image over an HttpURLConnection.
I know how to write text but I am having real problems trying
to write an
image
I have succeeded in
writing to the local HD using
Image swap on mouse over and mouse moveImage swap on mouse
over and mouse move i tried the code , sent form u...But if there are 50 images and..i want swap images on mousse
over and mouse out, then the code becomes very lengthy...so please give the code for multiple
Advertisements
Image swap on mouse over and mouse moveImage swap on mouse
over and mouse move i tried the code , sent form u...But if there are 50 images and..i want swap images on mousse
over and mouse out, then the code becomes very lengthy...so please give the code for multiple
Print the URL of a URLConnection
Print the URL of a
URLConnection
In this section we are going to describe, how to
retieve... that we use the getURL() which returns the value of this
URLConnection's
URL field
Ghost Writing Ghost
Writing
Ghost
Writing is the kind of
writing when someone... of
writing it. So ghostwriter
is a person who works behind the scene on a
writing project
in return of certain amount. The write-ups of the writer
imageimage how to add the
image in servlet code
ImageImage how to insert
image in xsl without using xml. the
image was displayed in pdf..Please help me
ImageImage how to insert
image in xsl without using xml. the
image was displayed in pdf..Please help me
ImageImage how to insert
image in xsl without using xml. the
image was displayed in pdf..Please help me
image image Dear every body please help me how to add and retrive
image and video into oracle 11g using jsp
writing characterswriting characters how to write a group of characters to a string ...
i mean for
writing single character using charAt in java
SEO Writing is the demand of SEM and SEO article
writing services. A good command
over...SEM and SEO Article
Writing
SEM and SEO article helps your business to grow... the intended traffic through SEM and SEO article
writing in addition to other tools
method over ridingmethod
over riding write a java program to compute volume of sphere and volume of cylinder using method
over riding
Blog WritingBlog
Writing
A blog, the short form of web log
is an online user... on
that. But the professionals are a better choice for
writing
the blog for commercial or promotional purpose. We provides
the services of
writing blogs for the commercial
mouse over effects in cssmouse
over effects in css I have written a mouse
over effect in CSS. But it is not working in HTML.
Can any one suggest me?
Thanks
Writing ActionsWriting Actions
The Action is responsible for controlling of data flow within an application.
You can make any java class as action. But struts have some built in interface
and class for making action easily.
To make an Action class
Data over Voice CommunicationData
over Voice Communication I just Want to know that Data
Over Voice communication is possible in India or Not,
If not then Why.
and If Yes then Why
Please anyone give the answer
application over https application
over https Hi. This questions might be very simple but I would like to create a simple servlet program and want to access using https... while accessing https
over http
hibernate over Jdbchibernate
over Jdbc Why use hibernate
over Jdbc?
Hibernate provides lots of advantages
over JDBC. Some of them are as below:
1) Hibernate is data base independent
2) Hibernate provides its own query language called
Installing programs over a networkInstalling programs
over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a networkInstalling programs
over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a networkInstalling programs
over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a networkInstalling programs
over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a networkInstalling programs
over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a networkInstalling programs
over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
RMI over Internet - RMIRMI
over Internet Hello I've made a project which utilizes rmi for communication.
Problem: I am unable to communicate using rmi
over internet
1)the clients cannot connect to me
2)I am using client side callbacks
writing plugin - WebSeviceswriting plugin can anyone help me in
writing plugin for internet explorer browser using c++ in .net environment
Is AI taking over the world?Is AI taking
over the world? Hi,
I am beginner in Data Science... taking
over the world?
Try to provide me good examples or tutorials links so that I can learn the
topic "Is AI taking
over the world?". Also tell me
Web Writing
Web
Writing
The art of
writing for the web is far removed from
writing for the print world....
Following is the prime aspect you need to keep in mind while
writing for the web
Transmitting messages over netTransmitting messages
over net A method whereby messages to be transmitted between computers are all sent to a central computer, which gathers them and routes them to the appropriate destinations is known as -
1. Message
how to set background imagehow to set background image how to set
image in background in that
image i want
over lay text how it possible in jsp?
using flash
image how it is overlayed in jsp page?
thanks
Content Writing Job be fluent in
writing
Good command
over language and grammar...
Content
Writing Job
In the field of Content
writing it is very important
ModuleNotFoundError: No module named 'over-stats'ModuleNotFoundError: No module named '
over-stats' Hi,
My Python... '
over-stats'
How to remove the ModuleNotFoundError: No module named '
over... have to install padas library.
You can install
over-stats python
Freelance Writing as a CareerFreelance
Writing as a Career
Pen has a great power of its own and its... and journalists.
Freelance
Writing – What Is Required?
Choosing freelance
writing as a career seems to be an
extremely easy way of making bucks
Swap images oon mouse over and mouse outSwap images oon mouse
over and mouse out I have multiple images...i want to swap each
image on mouse out and mouse
over..
<html>...) {
arr = new Array();
arr[1] = new
Image();
arr[1].src = "rose1.jpg";
arr[2] = new