Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to upload content for type file?

Received: by 10.101.112.3 with SMTP id p3mr1947568anm.0.1332357503463;
        Wed, 21 Mar 2012 12:18:23 -0700 (PDT)
X-BeenThere: springpaddev@googlegroups.com
Received: by 10.101.10.12 with SMTP id n12ls419927ani.5.gmail; Wed, 21 Mar
 2012 12:18:23 -0700 (PDT)
Received: by 10.236.192.164 with SMTP id i24mr6196720yhn.8.1332357503133;
        Wed, 21 Mar 2012 12:18:23 -0700 (PDT)
Received: by 10.236.192.164 with SMTP id i24mr6196719yhn.8.1332357503121;
        Wed, 21 Mar 2012 12:18:23 -0700 (PDT)
Return-Path: <jhor...@gmail.com>
Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.213.181])
        by gmr-mx.google.com with ESMTPS id y53si1587538yhe.4.2012.03.21.12.18.23
        (version=TLSv1/SSLv3 cipher=OTHER);
        Wed, 21 Mar 2012 12:18:23 -0700 (PDT)
Received-SPF: pass (google.com: domain of jhor...@gmail.com designates 209.85.213.181 as permitted sender) client-ip=209.85.213.181;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jhor...@gmail.com designates 209.85.213.181 as permitted sender) smtp.mail=jhor...@gmail.com; dkim=pass header...@gmail.com
Received: by yenq2 with SMTP id q2so1463265yen.40
        for <springpaddev@googlegroups.com>; Wed, 21 Mar 2012 12:18:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:x-mailer
         :mime-version:content-type:content-transfer-encoding
         :content-disposition;
        bh=PhyIMzOV4x0TfWfd+FNTeuZB/m0LvDyuMCF2epNY0Zo=;
        b=R6hBKGTJkG2CizVTKOVNc33xKi65MYUvjinwVmLMITVtxEh13iutR8wKr3cNYyx3Wl
         /Yjgi8rrHGfRls9FVs1mk92UV5CwYhvtRulLAxfh3zAH9pE22PiezAXjN0X5uJWIvH35
         RFgvFWt9Q6+e4zzXj8Tk3OIDLHrszc5yeo/9DpWPqB/YTfsYD1ylvWP9yCBiTH0fOI67
         UOlEqgUU2CjJNh5Z0Ej69OCtPc9mvxZAXSGEscFi+Ch8ruJFiTpO+pMyLUsZlNS/B4Du
         9s4pGZQGzF0PwZr06p5MrM+gLVoU/CXBTWRsLl7dag8ULguce5dYEAkFLjoQE8SZ9N0b
         nbRw==
Received: by 10.224.33.18 with SMTP id f18mr3755593qad.39.1332357503039;
        Wed, 21 Mar 2012 12:18:23 -0700 (PDT)
Return-Path: <jhor...@gmail.com>
Received: from jhorman-air.local (50-78-15-214-static.hfc.comcastbusiness.net. [50.78.15.214])
        by mx.google.com with ESMTPS id hr2sm4328037qab.8.2012.03.21.12.18.20
        (version=TLSv1/SSLv3 cipher=OTHER);
        Wed, 21 Mar 2012 12:18:22 -0700 (PDT)
Date: Wed, 21 Mar 2012 15:18:19 -0400
From: Jason Horman <jhor...@gmail.com>
To: springpaddev@googlegroups.com
Message-ID: <F455E23CDB124C859BC140170E627...@gmail.com>
In-Reply-To: <9386013.343.1332356478910.JavaMail.geo-discussion-forums@ynls18>
References: <20073908.543.1331677519095.JavaMail.geo-discussion-forums@vbw10>
 <82207.6014.1331836901237.JavaMail.geo-discussion-forums@vbux23>
 <39E2A4961473427B8411352484797...@gmail.com>
 <29202595.6055.1331838011827.JavaMail.geo-discussion-forums@vbux23>
 <3056ADB28CF44C14BFBFB6D638104...@gmail.com>
 <19330444.5523.1331838497666.JavaMail.geo-discussion-forums@vblb5>
 <246F4733326343DFAE329DFCEFAB2...@gmail.com>
 <10767642.592.1332183080791.JavaMail.geo-discussion-forums@vbhz5>
 <75968754-3517-4856-8007-9c4c6fc70...@fh22g2000vbb.googlegroups.com>
 <32346852.433.1332355007735.JavaMail.geo-discussion-forums@vbat19>
 <D49E2F47D548415DA66560E28CEA3...@gmail.com>
 <14385836.614.1332356400340.JavaMail.geo-discussion-forums@vbcv2>
 <9386013.343.1332356478910.JavaMail.geo-discussion-forums@ynls18>
Subject: Re: How to upload content for type file?
X-Mailer: sparrow 1.5 (build 1043.1)
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have not tried doing this from javascript myself, but I do see support for base64. There are a few tricks to make it work though. You can see it happening if you drag a file onto a canvas on the web in a notebook.

The URL is

http://springpadit.com/api/users/me/blocks/f7325516-ff1e-452b-8071-fffceca3a23/files?filename=something.pdf&encoding=base64

Payload:
data:base64,SW5kZXg6IC4uLy4uLy4uL3NyYy9tYWluL2phdmEvY29tL3NwcmluZy9zdGFjay9jbGllbnQvc3RvcmFnZS9Mb2NhbFNlYXJjaC5qYXZhCklERUEgYWRkaXRpb25hbCBpbmZvOgpTdWJzeXN0ZW06IGNvbS5pbnRlbGxp

So the trick is both to do a query param of "encoding=base64" and prefix the post data with "data:base64,"

If you have further trouble maybe we should just hop on an IRC channel or something. (not that I have one setup at the moment, but we could)


On Wednesday, March 21, 2012 at 3:01 PM, sziegler wrote:

> Sorry, I meant when I am sending in UTF-8 I'm NOT able to open the files!