我想通过HttpURLConnection写图像。通过URLConnection写图像
我知道怎么写的文字,但我有试图 写的图像
我已经成功地写入本地HD使用ImageIO的实际问题:
但我想通过写图片ImageIO的关于URL和失败
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);
的的uploadURL是链接直接将上传的图片在“内容处置指定的文件名在服务器上的ASP页:部分
现在,当我发送这个然后asp页面找到请求并找到文件的名称。但没有找到要上传的文件。
的问题是,ImageIO的URL上书写时会出现什么文件的名称在其上的ImageIO是写作,
所以,请帮助我的ImageIO如何写上URLConnection的图像,我怎么能知道我有在ASP页面中使用上传文件
感谢您抽出宝贵的时间来阅读这篇文章 迪利普·阿加瓦尔
实际上我在客户端使用小程序,所以我无法访问客户端的文件系统。我必须在ImageIO的帮助下创建小程序显示的图表的图像(如它在写入文件系统期间工作)。所以我必须直接从ImageIO上写URLConnection。这就是为什么我问ImageIO如何将图像内容写入URLConnection中的图像文件以及如何设置该图像文件的名称或知道该图像文件的名称 – 2011-02-03 08:24:02