如何上传服务器目录上的图像

问题描述:

嗨在Java小程序部分我正在使用下面的代码发送请求upload.asp页面上传图像在服务器directory.Please告诉我在asp经典如何上传图像在无需使用第三方服务器目录dll的如何上传服务器目录上的图像

Dimension size = perfchart.getSize(); 
    BufferedImage myImage = new BufferedImage(size.width, 
      size.height, BufferedImage.TYPE_INT_RGB); 
    Graphics2D g2 = myImage.createGraphics(); 
    perfchart.paint(g2); 

    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", "image/png"); 
    connection.setRequestProperty("Content-Transfer-Encoding", "binary"); 
    connection.setRequestProperty("Content-Disposition", "form-data; name=\"" + FIELD_NAME +"\"; filename=\"" + fileName + "\""); 
    output = new DataOutputStream(connection.getOutputStream()); 

    output.writeBytes("--" + boundary + "\r\n"); // throws IOException 
    ImageIO.write(image, imageType, output); 

所以请告诉我,我是如何通过ASP经典上传图片。有没有在这java代码更改任何要求,请告诉我,也

+1

不知道它是什么了与WordPress做? – 2011-02-02 13:24:19

这是传统的ASP解决方案:

http://www.asp101.com/articles/jacob/scriptupload.asp

和纯ASP上传:(服务器现在没有响应吧!)

http://freeaspupload.net

不过,我建议使用.NET解决方案,如果你的服务器已经启用了.NET:

https://msdn.microsoft.com/en-us/library/aa479405.aspx

http://www.4guysfromrolla.com/webtech/091201-1.shtml