私はjspページでjava webervicesでSilverlight4を使用しています。私はサーバーに画像を保存して、java webserviceでこれをやろうとします。以下の行のコードを使用していますが、出力が壊れています。私は、ファイルが破損して、損傷したり、大きすぎるため、tがこの絵を開くt understand why. Please help me. This is really important for me. When i try to open 3mb jpeg file contains "Windows Photo Viewer can
ドン。」Silverlight 4イメージアップロードの問題
クライアント側のコード
WriteableBitmap wb = new WriteableBitmap(bitmapImage);
byte[] bb = ToByteArray(wb);
public byte[] ToByteArray(WriteableBitmap bmp)
{
int[] p = bmp.Pixels;
int len = p.Length * 4;
byte[] result = new byte[len]; // ARGB
Buffer.BlockCopy(p, 0, result, 0, len);
return result;
}
WebServiceのコード
@WebMethod(operationName = "saveImage")
public Boolean saveImage(@WebParam(name = "img")
byte[] img, @WebParam(name = "path")
String path) {
try{
FileOutputStream fos = new FileOutputStream("C:\\Users\\TheIntersect\\Desktop\\sharp_serializer_dll\\saved.jpg");
fos.write(img);
fos.close();
return true;
}
catch(Exception e){
return false;
}
}