You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Goog Cheng <go...@gmail.com> on 2012/08/21 03:32:25 UTC

the fastest way to upload attachments

Hey,pal! a common way to upload attachments to CouchDB is to ajax a form 
including a file, I wanna know the fastest way to upload attachments. 
Does it need to apply a backend(I like the RESTful).Any guidance would 
be greatly appreciated.

Re: the fastest way to upload attachments

Posted by Andrey Kuprianov <an...@gmail.com>.
Have you tried smth like  http://packages.python.org/CouchDB/ ?

On Tue, Aug 21, 2012 at 12:51 PM, goog cheng <go...@gmail.com> wrote:

> Thanks! Mmm, if with python, which method is more better?
>
> 2012/8/21 Andrey Kuprianov <an...@gmail.com>
>
> > What is your setup?
> >
> > Basically you would usually upload file first, save it in in some
> temporary
> > directory and then attach your existing couch document. After that the
> > attachment can be either done with cURL directly, or you can use some
> > helper library to do it. In my case, I use PHP-On-Couch (
> >
> >
> https://github.com/dready92/PHP-on-Couch/blob/master/doc/couch_client-document.md#attaching-a-file-to-a-document
> >  ).
> >
> > On Tue, Aug 21, 2012 at 9:32 AM, Goog Cheng <go...@gmail.com> wrote:
> >
> > > Hey,pal! a common way to upload attachments to CouchDB is to ajax a
> form
> > > including a file, I wanna know the fastest way to upload attachments.
> > Does
> > > it need to apply a backend(I like the RESTful).Any guidance would be
> > > greatly appreciated.
> > >
> >
>

Re: the fastest way to upload attachments

Posted by goog cheng <go...@gmail.com>.
Thanks! Mmm, if with python, which method is more better?

2012/8/21 Andrey Kuprianov <an...@gmail.com>

> What is your setup?
>
> Basically you would usually upload file first, save it in in some temporary
> directory and then attach your existing couch document. After that the
> attachment can be either done with cURL directly, or you can use some
> helper library to do it. In my case, I use PHP-On-Couch (
>
> https://github.com/dready92/PHP-on-Couch/blob/master/doc/couch_client-document.md#attaching-a-file-to-a-document
>  ).
>
> On Tue, Aug 21, 2012 at 9:32 AM, Goog Cheng <go...@gmail.com> wrote:
>
> > Hey,pal! a common way to upload attachments to CouchDB is to ajax a form
> > including a file, I wanna know the fastest way to upload attachments.
> Does
> > it need to apply a backend(I like the RESTful).Any guidance would be
> > greatly appreciated.
> >
>

Re: the fastest way to upload attachments

Posted by Mark Hahn <ma...@hahnca.com>.
I don't know if this will be helpful, but this is what I do using nginx and
node.  It is efficient and easy.

I use nginx to upload the file and proxy the upload to node.  Nginx waits
until the file is uploaded and then sends a request to node that just has
the file location on the disk.  Then I use nano to attach the file to couch.

Even if you upload the file some other way, I highly recommend nano.  One
nano command does the attachment ...

    fs.createReadStream(filePath).pipe(nano.attachment.insert  id,
attachmentName, null, ...

Re: the fastest way to upload attachments

Posted by Andrey Kuprianov <an...@gmail.com>.
What is your setup?

Basically you would usually upload file first, save it in in some temporary
directory and then attach your existing couch document. After that the
attachment can be either done with cURL directly, or you can use some
helper library to do it. In my case, I use PHP-On-Couch (
https://github.com/dready92/PHP-on-Couch/blob/master/doc/couch_client-document.md#attaching-a-file-to-a-document
 ).

On Tue, Aug 21, 2012 at 9:32 AM, Goog Cheng <go...@gmail.com> wrote:

> Hey,pal! a common way to upload attachments to CouchDB is to ajax a form
> including a file, I wanna know the fastest way to upload attachments. Does
> it need to apply a backend(I like the RESTful).Any guidance would be
> greatly appreciated.
>