From couchdb-user-return-1905-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Sun Nov 16 15:47:06 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 4291 invoked from network); 16 Nov 2008 15:47:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Nov 2008 15:47:06 -0000 Received: (qmail 9216 invoked by uid 500); 16 Nov 2008 15:47:13 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 9171 invoked by uid 500); 16 Nov 2008 15:47:12 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 9160 invoked by uid 99); 16 Nov 2008 15:47:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Nov 2008 07:47:12 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jwalgran@gmail.com designates 209.85.198.249 as permitted sender) Received: from [209.85.198.249] (HELO rv-out-0708.google.com) (209.85.198.249) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Nov 2008 15:45:51 +0000 Received: by rv-out-0708.google.com with SMTP id k29so2433531rvb.0 for ; Sun, 16 Nov 2008 07:46:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=aeSXYNQKLKNeUHIuT7wra6X8MHKpd4/ikz2fAWAzPyw=; b=TWELX5pVYpPFGcnWxmGxpqWHOHWFzJjxa4qJHKmpQyi1XN50x8Uqxd6raIpj4alp3x tCxLKzSKoddY1sImno+xOSF1WAYJ7UffA4XhlaPMzxtaMeD3WmAMww3M4A15tJcsMKyj NLat2XebXMOJyE7FMW0Cy1K0+nYo9OX12T/sA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=P++EINdXkS4jHBqNFaIr1oY/dR2PxAQzHBm7lMtt5y6oyvgEwD27hRtPZGGvN1zwrp RKgRKbI2tlt/P1WyM7OK5tAiDLH6V1VOZG/riz28/4F7emRuypvAQPylUNPV+LOEpXj1 QvDEUPKHexF+fjJlrSuRbcIWJzOfMn1QzoBTs= Received: by 10.141.161.6 with SMTP id n6mr1698840rvo.229.1226850386300; Sun, 16 Nov 2008 07:46:26 -0800 (PST) Received: by 10.140.226.20 with HTTP; Sun, 16 Nov 2008 07:46:26 -0800 (PST) Message-ID: Date: Sun, 16 Nov 2008 10:46:26 -0500 From: "Justin Walgran" Reply-To: jwalgran@gmail.com To: couchdb-user@incubator.apache.org Subject: Uploading a file from an html form to a CouchDB attachment MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org I have been puzzling over the best way to upload a file from an HTML form and have it end up as an attachment to a new CouchDB document. Here is what I would like to do: 1) User select file using a "file" form element 2) User clicks the submit button 3) New CouchDB doc is created 4) Selected document is POSTed as an attachment to the new CouchDB doc One snag is the fact that jquery.couch.DB.saveDoc does not not return the autogenerated doc id, which makes it impossible to generate the attachment url. The bigger snag is the chaining of the two POSTs together. Based on my preliminary Googling It does not appear possible to trigger a file upload from javascript. Has anyone tackled this? - Justin Walgran