0

im trying to upload user Avatar for register User and use a image crop plugin to crop it in client side . when i get dataurl and set it to in src attribute it work fine but when i upload it with ajax in c# code i get the string by Request["Avatar"] and get something like this: http://8pic.ir/images/hsiw5swg5alp3xtfvxii.png

but when i trying to convert it to byte in base64 i get following error: http://8pic.ir/images/qvaehyf66rs3rdr9xp91.png

so whats wrong with my code and what can i do ?

0

1 Answer 1

1

solved guys i must make some change to base64 string in server side : i add this code and fix the problem

Avatar = Avatar.Replace(" ", "+");
        if (Avatar.Length % 4 != 0)
        {
            Avatar += new string('=', 4 - Avatar.Length % 4);
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.