Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid Content-Length is sent to the server?
    primarykey
    data
    text
    <p>I'm trying to upload a photo to the popular service Dailybooth via their new API through the method <a href="http://developers.dailybooth.com/pictures" rel="nofollow">documented here</a>.</p> <p>The problem is that the server is responding with:</p> <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;411 Length Required&lt;/title&gt;... </code></pre> <p>The code I'm using to send this data is here:</p> <pre><code>// 2: Build request HttpClient httpclient = new DefaultHttpClient(); SharedPreferences settings = DailyboothShared.getPrefs(DailyboothTakePhoto.this); String oauth_token = settings.getString("oauth_token", ""); HttpPost httppost = new HttpPost( "https://api.dailybooth.com/v1/pictures.json?oauth_token=" + oauth_token); Log.d("upload", "Facebook: " + facebook); Log.d("upload", "Twitter: " + twitter); try { InputStream f = getContentResolver().openInputStream(snap_url); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("picture", new InputStreamBody(f, snap_url.getLastPathSegment())); entity.addPart("blurb", new StringBody(blurb)); entity.addPart("publish_to[facebook]", new StringBody(facebook)); entity.addPart("publish_to[twiter]", new StringBody(twitter)); httppost.setEntity(entity); HttpResponse response = httpclient.execute(httppost); Log.d("upload", response.toString()); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 200) { // do something? } else { Log.d("upload", "Something went wrong :/"); } Log.d("upload", EntityUtils.toString(response.getEntity())); } catch (Exception ex) { ex.printStackTrace(); } </code></pre> <p>I've got no idea what I'm doing wrong.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload