Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: jQuery JSON WebService
Hi,
I am trying to save Base64 data in to database.
But I am not able to send dataUrl to my .asmx file.
 
Jquery
function UploadUserPhoto() {                
    var Mycanvas = document.getElementById("tempCanvas");
    var dataURL = Mycanvas.toDataURL("image/png");               
                
    $.ajax({
        url: "LP18WS.asmx/UploadPhoto",
        contentType: "application/json; charset=utf-8",
        data: {
            Base64String: "\'" + dataURL + "\'"
        },
        dataType: "json",
        success: function (msg) {
            alert(msg.d);
        },
        error: function (msg) {
            alert(msg + '\n' + xhr.responseText);
        },
    });
}
Webservice (LP18WS.asmx)
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json,  UseHttpGet = true)]
public string UploadPhoto(string Base64String)
{
   string message = "";
    //code to save data url in database            
   return message;
}
But it is not sending the dataurl. If I put some other string instead of dataurl it is working.
Why this dataurl can't send?. Can any one guid me?

I have observed that it is happening when there are large amount of data within dataURL. Otherwise when the amount of data is minimum it is working. Can you give me a solution to overcome this situation.
Posted 25-Apr-13 2:56am
Edited 25-Apr-13 6:13am
(no name)47.6K
v3
Comments
Prasad Khandekar at 25-Apr-13 11:15am
   
Don't use GET, use Post to sending large data. Query string length is generally limited to few kbs.
SHAJANCHERIAN at 27-Apr-13 9:46am
   
Thank you. Its working..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 25 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100