incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ajay Pawaskar" <>
Subject Fetching Attachment Containing Image
Date Mon, 10 Oct 2011 07:42:16 GMT

            I am trying to fetch a attachment from couch containing
image and trying to render it on browser.


            I m uploading attachment using futon

            My couch document looks like

   "_id": "522_10_1",
   "_rev": "3-b02fbfd9d212575488c297e5cb6845e2",
   "_attachments": {
       "522_10_1.jpg": {
           "content_type": "image/jpeg",
           "revpos": 2,
           "length": 185243,
           "stub": true
When I click on attachment "522_10_1.jpg" it's rendering properly, but
when I tried to fetch it from .net code & render, it's giving me
I am using following code
Hitting http://localhost:5984/executabledb_bre/522_10_1/522_10_1.jpg"
from server side code 
Capturing response in Variable Resp
Resp = Resp.Replace(Environment.NewLine, "").Replace("\r",
"").Replace("\0", ""); // removing newline & carriage return if any
Response.ContentType = "image/jpeg";
Response.Write(Resp); // as Resp suppose to be Base64 String 
On browser I got following error on browser (Default.aspx is a page I m
hitting to retrieve image & render it)
The image "http://localhost:4265/Default.aspx" cannot be displayed
because it contains errors.
HTML thrown on page looks like this
<img src="http://localhost:4265/Default.aspx" alt="The image
"http://localhost:4265/Default.aspx" cannot be displayed because it
contains errors.">
Also I tried to convert it into Bit Array it gives me a runtime error
The input is not a valid Base-64 string as it contains a non-base 64
character, more than two padding characters, or a non-white space
character among the padding characters.


I don't want to hit couch directly from browser like


            Anyone please let me know what I am doing wrong.



No trees were killed in sending this message; 

however, a large number of electrons were
terribly inconvenienced...



Ajay J. Pawaskar


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message