以下のエラーが表示されます。
Cannot process the message because the content type
'multipart/form-data;
boundary=0JxmnFLOmjvutAKrtR1bmPCqpG8M6WbwE-aAvh8' was not the expected
type 'text/xml; charset=utf-8'
Android コード:
HttpPost httppost = new HttpPost("http://192.168.9.103/AndroidService/MediaUploadService.svc/uploadFile1");
File photo = new File(Environment.getExternalStorageDirectory(), "01.jpg");
MultipartEntity t = new MultipartEntity();
t.addPart("t", new FileBody(photo));
httppost.setEntity(t);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httppost);
WCF コード:
public class MediaUploadService : IMediaUploadService
{
public void UploadFile(Stream fileContents)
{
byte[] buffer = new byte[10000];
int bytesRead, totalBytesRead = 0;
do
{
bytesRead = fileContents.Read(buffer, 0, buffer.Length);
totalBytesRead += bytesRead;
} while (bytesRead > 0);
File.WriteAllText(@"D:\\Vechile\log2.txt", totalBytesRead.ToString());
}
}
このプロセスを行うのを手伝ってくれる人はいますか?
私の問題:
-Androidからサーバーに画像ファイルをアップロードする必要があります(IIS経由-> .asp、.asmx、.svcなど)
誰でもこの問題について私に提案できますか?