I am trying to upload a file for an existing ASMX service that we have (See C # below). We currently have a Silverlight app that uses the service without any problems, but I have not been successful in getting our new app using AJX to serve me.
I have consulted for advice on them. Much of these:
have a type = "file" that triggers this function:
function ArrayBufferToBase64 (buffer) {var binary = '' ; Var bytes = new UIT 8 array (buffer); (Var xx = 0, len = bytes. ByteLength; xx
The service resides in SharePoint and looks like this:
[webserver (namespace = "http://www.blah.com/" )] [WebServiceBinding (ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem (false)] [System.Web.Script.Services.ScriptService] public class FileInfo: System.Web.Services.WebService {[WebMethod (EnableSession = true)] public TempDocumentInfo AddScannedItem (string instanceId, Yuri string, string itemKey, string data, string extension) {byte [] bytes = new byte [data. Height * size (four)]; System.Buffer.BlockCopy (data. ToCharArray (), 0, bytes, 0, bytes lang); Var stream = new memorystream (bytes); . . . }}
Once I have data in C #, then I can not be able to do anything with it. for example. A BMP throws an exception in uploading and processing the image:
var blah = System.Windows .media imaging .BmpBitmapDecoder. (Stream, Bitmapcreate Option, Protocol Pixel Format, BitmapCustomization.
Am I not creating AJAX request correctly?
So it has come to know that I was not converting the data by [] correctly. Instead:
New Byte [data length * size (four)]; System.Buffer.BlockCopy (data. ToCharArray (), 0, bytes, 0, bytes. Lang);
I did this :
byte [] bytes = conver Tkfonbbes 64 string (data);
now works fine.
No comments:
Post a Comment