need to store the data in Binary format for the Uoploaded file

Thread is closed for posting
2 posts, 0 answers
  1. Gopi
    Gopi avatar
    15 posts
    Member since:
    Jan 2013

    Posted 09 Jan 2015 Link to this post

    Here is the code I tried to store the data in binary format for the uploaded file.....................



    protected void Button1_Click(object sender, EventArgs e)
    {
        int PartyRowId = 0;
        foreach (UploadedFile file in AsyncUpload1.UploadedFiles)
        {
            byte[] bytes = new byte[file.ContentLength];
            file.InputStream.Read(bytes, 0, Convert.ToInt32(file.ContentLength));
            string json3 = "{'PartyRowId':" + PartyRowId + ",'CommonCategoryRowId':" + PartyRowId + ",'CommnonCategoryAttributesRowId':" + PartyRowId + ",'PartyDoc':" + bytes + "}";
            string status = ClsUtility.HttpPost("http://localhost/ServiceWrapper/MetaData.svc/PartyDocumentsID", json3);
     
        }
    }


    i get the Json as


    {'PartyRowId':0,'CommonCategoryRowId':0,'CommnonCategoryAttributesRowId':0,'PartyDoc':System.Byte[]}


    not able to retrieve the binary data Please help me......



  2. Gopi
    Gopi avatar
    15 posts
    Member since:
    Jan 2013

    Posted 10 Jan 2015 Link to this post


    I should use Convert.ToBase64String();

    i.e
    string json3 = "{'PartyRowId':" + PartyRowId + ",'CommonCategoryRowId':" + PartyRowId + ",'CommnonCategoryAttributesRowId':" + PartyRowId + ",'PartyDoc':" + Convert.ToBase64String(bytes)+ "}";
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top