Loading ...
Sorry, an error occurred while loading the content.

Re: [json] Sending an image using JSON

Expand Messages
  • Jorge Chamorro
    ... The browser can upload a local file to a server via a form through a POST, but your page s javascript code can t touch nor read a local file at all, at
    Message 1 of 11 , Mar 9 2:20 AM
    • 0 Attachment
      On 08/03/2010, at 19:37, farkmischer wrote:
      > I am trying to figure out how to send an image from my hard drive to Tuzulo using their api which appears to use JSON (quoted below). I have figured out how to receive information about what images I have with them and their URLs but cannot figure out how to send an image. I have found lots of JSON examples but they all seem to show sending or receiving strings. Could someone give me a hint?
      >
      > Quoted From:
      > http://www.tuzulo.com/info/api
      >
      > Quote
      > Private API URLsThese URLs require private keys, used for management and extension. To protect each upload, the private key must be known (saved, bookmarked, etc.). With an account, this becomes transparent.
      >
      > http://www.tuzulo.com/add/<private-key>
      >
      > Extend collection.
      >
      > http://www.tuzulo.com/upload/<private-key>
      >
      > Manage collection.
      >
      > Public keys are meant to be shared while private keys are meant to be temporarily bookmarked if necessary. Bookmarking is unnecessary when you're a site member.
      > End Quote
      >

      The browser can upload a local file to a server via a form through a POST, but your page's javascript code can't touch nor read a local file at all, at least not if the location.href is anything other than file:/// (e.g., not in a page that's coming from http://tuzulo.com).
      --
      Jorge.

      [Non-text portions of this message have been removed]
    • farkmischer
      In response to a couple of quesitons I am using ASP.Net to do this so I do have access to the filesystem. Over the last few days I have determined in .net how
      Message 2 of 11 , Mar 9 9:06 PM
      • 0 Attachment
        In response to a couple of quesitons I am using ASP.Net to do this so I do have access to the filesystem. Over the last few days I have determined in .net how to format in image in Base64 and send the string to a URL (see below). However this still does not work. I get a "The remote server returned an error: (403) Forbidden." error. I believe that I am not formating what I am sending to tuzulo properly but am not sure what the string should look like. I also tried uploading the image directly without encoding it in Base64 like this client.UploadFile("http://tuzulo.com/add/***private key***", imgPhoto) but that did not work either. I'm not sure how to find out how to format my send, there does not seem to be a lot of information out there on this.

        CODE:
        System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile("c:\\test.jpg");
        string ImageBase64 = ImageToBase64(imgPhoto, System.Drawing.Imaging.ImageFormat.Jpeg);

        using (WebClient client = new WebClient())
        {
        return client.UploadString("http://tuzulo.com/add/***private key***", ImageBase64);
        }
        CODE:

        --- In json@yahoogroups.com, "farkmischer" <farkmischer@...> wrote:
        >
        > I am trying to figure out how to send an image from my hard drive to Tuzulo using their api which appears to use JSON (quoted below). I have figured out how to receive information about what images I have with them and their URLs but cannot figure out how to send an image. I have found lots of JSON examples but they all seem to show sending or receiving strings. Could someone give me a hint?
        >
        > Quoted From:
        > http://www.tuzulo.com/info/api
        >
        > Quote
        > Private API URLsThese URLs require private keys, used for management and extension. To protect each upload, the private key must be known (saved, bookmarked, etc.). With an account, this becomes transparent.
        >
        > http://www.tuzulo.com/add/<private-key>
        >
        > Extend collection.
        >
        > http://www.tuzulo.com/upload/<private-key>
        >
        > Manage collection.
        >
        > Public keys are meant to be shared while private keys are meant to be temporarily bookmarked if necessary. Bookmarking is unnecessary when you're a site member.
        > End Quote
        >
      • Josh Sled
        ... You should ask tuzulo.com about how to use their API. This isn t a tuzulo.com support forum, and your question is only tangentially related to json. --
        Message 3 of 11 , Mar 10 6:23 AM
        • 0 Attachment
          "farkmischer" <farkmischer@...> writes:

          > client.UploadFile("http://tuzulo.com/add/***private key***", imgPhoto) but that did not work either. I'm not sure how
          > to find out how to format my send, there does not seem to be a lot of information out there on this.

          You should ask tuzulo.com about how to use their API. This isn't a
          tuzulo.com support forum, and your question is only tangentially related
          to json.

          --
          ...jsled
          http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
        • farkmischer
          I apologize, you are right. I started out not even knowing how to use JSON so that is why I started here. Now that I figured out how to use JSON in .net I
          Message 4 of 11 , Mar 10 6:51 AM
          • 0 Attachment
            I apologize, you are right. I started out not even knowing how to use JSON so that is why I started here. Now that I figured out how to use JSON in .net I will contact tuzulo. They have a support forum that doesn't let you post to so I'll have to figure out how to contact them.

            --- In json@yahoogroups.com, Josh Sled <jsled@...> wrote:
            >
            > "farkmischer" <farkmischer@...> writes:
            >
            > > client.UploadFile("http://tuzulo.com/add/***private key***", imgPhoto) but that did not work either. I'm not sure how
            > > to find out how to format my send, there does not seem to be a lot of information out there on this.
            >
            > You should ask tuzulo.com about how to use their API. This isn't a
            > tuzulo.com support forum, and your question is only tangentially related
            > to json.
            >
            > --
            > ...jsled
            > http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.