0

データベースにアップロードするphpスクリプトに画像を投稿するコードがあります。データベースに追加する場合、ファイルタイプはapplication / oct ???? (これは何ですか)

とにかくAndroidの段階でこれをjpgファイルに変更する方法はありますか?

以下は私のコードです

HttpClient client = new DefaultHttpClient();  
             String postURL = "http://10.0.2.2:90/mobileupload3.php";                
             HttpPost post = new HttpPost(postURL); 


         FileBody bin = new FileBody(file);

         MultipartEntity reqEntity = new MultipartEntity();  
         reqEntity.addPart("image", bin);
         reqEntity.addPart("name", new StringBody(enteredName));
         reqEntity.addPart("gender", new StringBody(radio));
         reqEntity.addPart("cat", new StringBody(radio2));
         reqEntity.addPart("lat", new StringBody(lat));
         reqEntity.addPart("lon", new StringBody(lon));

         post.setEntity(reqEntity);  
         HttpResponse response = client.execute(post);  
         HttpEntity resEntity = response.getEntity();  
         if (resEntity != null) {    
                   Log.i("RESPONSE",EntityUtils.toString(resEntity));
             }
    } catch (Exception e) {
        e.printStackTrace();
    }

    }
}
4

1 に答える 1

0

application/oct (という意味だと思いますapplication/octet-stream) は、一般的なバイナリ ファイルのMIMEタイプです。

アップロード方法に関する詳細情報がなくても、質問の他の部分は SO here で既に回答されていると思います。

于 2011-02-08T21:32:40.807 に答える