2011-02-02 40 views
0

嗨在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

回答