问题描述
publicvoiddoUploadFile()throwsException{Stringjkxlh="791F0909030617040815E6958E9DFF8FFC9E39343238575840746D72692E636E";Stringxtlb="01";Stringjkid="01C86";Stringxh="14";Stringhpzl="02";Stringhphm=URLEncoder.encode("路AEEA4A","UTF-8");Stringfile="E:/liuwx.jpg";ByteArrayOutputStreambos=newByteArrayOutputStream();BufferedInputStreambis=newBufferedInputStream(newFileInputStream(file));intlen;while((len=bis.read())>-1){bos.write(len);}bytefileData[]=bos.toByteArray();inttpsize1=fileData.length;Stringurlstr="http://localhost:9898/trffweb/uploadFile.frm?method=savePicture&jkxlh="+jkxlh;urlstr+="&xh="+xh+"&hpzl="+hpzl+"&hphm="+hphm+"&tpsize1="+tpsize1;urlstr+="&jkid="+jkid+"&xtlb="+xtlb;URLurl=newURL(urlstr);HttpURLConnectionhuc=(HttpURLConnection)url.openConnection();huc.setRequestProperty("content-type","text/html");huc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");huc.setDoOutput(true);huc.setDoInput(true);huc.setRequestMethod("POST");huc.setConnectTimeout(500000);OutputStreampw=huc.getOutputStream();pw.write(fileData);pw.flush();pw.close();BufferedReaderbr=newBufferedReader(newInputStreamReader(huc.getInputStream()));Stringcontent="";Stringline=br.readLine();while(line!=null){content=content+line;line=br.readLine();}br.close();}帮着翻译成C#
解决方案
解决方案二:
语言都差不多,你把代码放到VS里,把不同的类替换一下就差不多了
解决方案三:
看着跟C#差不多。。