Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Image writing over URLConnection

Have Programming Question? Ask it here!
 
 
 


dilip agarwal
Image writing over URLConnection
0 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners


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


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Image writing over URLConnection
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
Image swap on mouse over and mouse move
Image 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 move
Image 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
Open a URLConnection to specific website address
Open a URLConnection to specific website address       Here we are going to establish... of URLConnection. After that we put the try and catch block and assign a URL
How to access the image file from project folder itself while writing to pdf using itext?
How to access the image file from project folder itself while writing to pdf using itext?  I am writing a pdf using itext where i add a image in the beginning of the document. When i use image = Image.getInstance("C
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
image
image  how to add the image in servlet code
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
method over riding
method over riding  write a java program to compute volume of sphere and volume of cylinder using method over riding
mouse over effects in css
mouse 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
Call UIViewController over RootViewController
Call UIViewController over RootViewController   Hi, i have created the window based application.. but not sure how to call the UIView over RootViewController. Thanks
SEO Writing
is the demand of SEM and SEO article writing services. A good command over... with the changing algorithm of search engines. Our expertise over writing SEM articles...SEM and SEO Article Writing SEM and SEO article helps your business to grow
Data over Voice Communication
Data 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
Blog Writing
Blog 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
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 Jdbc
hibernate 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 network
Installing 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 network
Installing 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 network
Installing 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 network
Installing 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 network
Installing 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 network
Installing 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 - RMI
RMI 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 Actions
Writing 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
Transmitting messages over net
Transmitting 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
why should we over ride hashCode(), when equals was over ride()?
why should we over ride hashCode(), when equals was over ride()?  why should we over ride hashCode(), when equals was over ride
dynamically writing text javascript
dynamically writing text javascript  dynamically writing text javascript. Is it possible
dynamically writing text javascript
dynamically writing text javascript  dynamically writing text javascript. Is it possible
What is the advantage of hibernate over JDBC?
What is the advantage of hibernate over JDBC?  HI, What is the advantage of hibernate over JDBC? thanks
What is the advantage of hibernate over JDBC?
What is the advantage of hibernate over JDBC?  HI, What is the advantage of hibernate over JDBC? thanks
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
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
writing plugin - WebSevices
writing plugin  can anyone help me in writing plugin for internet explorer browser using c++ in .net environment
writing HTML entirely by hand
writing HTML entirely by hand  How comfortable are you with writing HTML entirely by hand
Articles Writing,Articles Writing Services,Articles Writing India,Articles Writing & Content Development
Articles Writing and Content Development In web medium, content... be readable by all. As far as writing an article is concerned, then it becomes... and understandable by all in general. Article writing is the driving force of your
writing webservices in php
writing webservices in php  How to write a simple web service in PHP
Swap images oon mouse over and mouse out
Swap 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
How to iterate over a checkbox group
How to iterate over a checkbox group  Hi. I am new to using JQuery and would much appreciate your help. I have a form on which I've created 5..." groups. My plan of attack was to iterate over the MASTER checkbox group
Freelance Writing as a Career
Freelance 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
question "writing prog"
question "writing prog"  Hello I want helping for this question, please Write a program that reads some friendsā?? names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
Facts about Web Writing
Facts about Web Writing      ... are writing for. The most important ones are as follows- A majority of the users... of writing guidelines reduces the cognitive load of the users and as a result
FreeLance Writing JOb
FreeLance Writing JOb       Position Vacant: FreeLance Writing JOb  Job Description You will be writing contents for our blogs and content website. This jobs
Five Reasons for Outsourcing Business Writing
properly. Hence, outsourcing business writing also allows you to improve the image...Five Reasons for Outsourcing Business Writing One may possess excellent skills for initiating and running a writing business but this does not mean
writing aprogram - Java Beginners
writing aprogram  Write a program to reverse any string  Hi Friend, Try the following code: import java.util.*; class StringReverse{ public static void main(String[]args){ Scanner input=new Scanner(System.in
writing a code - Java Beginners
writing a code  write a code for a class called display that will display your name and age onto the screen  Hi Friend, Try the following code: class display{ String name; int age; public display(String n,int
File saving and Writing
File saving and Writing   Hello Rose india..... I have a doubt for you plzzz kindly Help me... I have an "Arraylist" which includes some table values... What i want to ask is "I want to create a jsp page which will include
VoIP Over Cable
VoIP Over Cable          Introduction of VoIP Over Cable Cable operators... and voice service over the same cable spectrum. Voice (and fax) service over
 

 

 

DMCA.com