Groups
Groups
Sign in
Groups
Groups
CouchApp
Conversations
About
Send feedback
Help
how to upload an attachment in a couchapp
58 views
Skip to first unread message
Goog Cheng
unread,
May 13, 2012, 2:59:40 AM
5/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to couc...@googlegroups.com
Hi, all! I forked from here :
https://github.com/jchris/proto/tree/photo
and add some lines to the index.html
<form id="recipe-upload" name="recipe-upload"><input id="_attachments" type="file" name="_attachments"/><input type="submit"/></form>
</body>
<script src="vendor/couchapp/loader.js"></script>
<script type="text/javascript" charset="utf-8">
$("#recipe-upload").submit(function(e) {
e.preventDefault();
var data = {};
$("form :file").each(function() {
data[
this.name
] = this.value;
});
if (!data._attachments || data._attachments.length == 0) {
alert("Please select a file to upload.");
return;
}
$(this).ajaxSubmit({
url:
"http://localhost:5984/doc/test"
,
success: function(resp) {
alert("ssss");
}
});
});
</script>
and why i have choose a file , it reminfs me
"Please select a file to upload."
Dave Cottlehuber
unread,
Nov 14, 2012, 4:46:33 PM
11/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to couc...@googlegroups.com
On 14 November 2012 21:05, R.J. Steinert <
r...@rjsteinert.com
> wrote:
> Here's a basic example that I wrote.
https://gist.github.com/4074427
> --
> You received this message because you are subscribed to the Google Groups
> "CouchApp" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/couchapp/-/_m3O7dg_C7AJ
.
> To post to this group, send email to
couc...@googlegroups.com
.
> To unsubscribe from this group, send email to
>
couchapp+u...@googlegroups.com
.
> For more options, visit this group at
>
http://groups.google.com/group/couchapp?hl=en
.
Nice work RJ! This would be a good addition to
http://wiki.apache.org/couchdb/Working_with_Forms
which is missing a
section "using client-side javascript", if you want to contribute it!
A+
Dave
Reply all
Reply to author
Forward
0 new messages