4

Android 앱을 통해 파일 + 문자열을 내 Rails 앱에 업로드하고 싶습니다. 레일에서 멀티 파트 업로드를 사용할 때 항상 이상한 오류가 발생합니다.mulitpart 업로드가 android + rails와 작동하지 않습니다.

클라이언트 측 Apache HttpClient 4.1.1 + httpMime Lib 4.1.1 및 서버 측 Rails 3.0.10을 사용하고 있습니다. - 누군가가 힌트를 가지고 나는 이것에 대한 어떤 해결책을 찾기 cannout

Error during failsafe response: ActionView::Template::Error 
    /Users/magu/.rvm/gems/[email protected]/gems/activesupport-3.0.10/lib/active_support/whiny_nil.rb:48:in `method_missing' 
    /Users/magu/.rvm/gems/[email protected]/gems/actionpack-3.0.10/lib/action_dispatch/http/parameters.rb:10:in `parameters' 
... 
    /Users/magu/.rvm/gems/[email protected]/ 
09:51:55 NoMethodError (undefined method `rewind' for "test":String): 

:

CountingMultipartEntity mpEntity = new CountingMultipartEntity(this); 
File file = new File(getRealPathFromURI(Uri.parse(local_uri))); 
ContentBody cbFile = new FileBody(file, "image/jpeg"); 

mpEntity.addPart("artifact[binary_payload]", cbFile); 
mpEntity.addPart("artifact[description]", new StringBody("test", Charset.forName("UTF-8"))); 

HttpPost post = new HttpPost(url); 
post.setEntity(mpEntity); 

HttpResponse response = mHttpClient.execute(post); 

이 레일에서 오류 줄 것입니까?

MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); 

을 그리고 작동 것 :

덕분에, 마틴

답변

4

이처럼 여러 부분 개체를 만듭니다.

+0

감사합니다. 그게 내게 두통을 준 :) – magegu

+0

만약 내가 할 수있는 +5 :) – Maragues

관련 문제