2

For a webbased application we want to be able to let people sign on an Ipad.running IOS We use a canvas element to draw on and then upload it to an IBM I Service.running net.data It works fine on chrome and firefox on a pc.

on an ipad in safari or chrome though the request seems to be empty. I am searching for hours and don’t seem to be able to find out what is wrong with this code.

Does anybody Know Who I Could Fix this? We are not using jquery by the way. belowe is part of the code we use

thanks! j.v.

GUI.Signature.dataURItoBlob = function(dataURI) {
  var binary = atob(dataURI.split(',')[1]);;
  var array = [];
  var content = null;
  for(var i = 0; i < binary.length; i++) {
    array.push(binary.charCodeAt(i));
  }
  content= new Uint8Array(array);
  return new Blob([content], {type: 'image/jpeg'}); 
};


GUI.Signature.send = function(){
  if(!GUI.Signature.isEnabled()){return;}
  var request = new XMLHttpRequest();
  var dataURL = GUI.Signature.canvas.toDataURL('image/jpeg', 0.8);
  var blob = GUI.Signature.dataURItoBlob(dataURL);
  var fd = new FormData(GLOBAL.activeForm);
  var fsUri = GLOBAL.activeForm.action.replace("MAIN","UPLOAD");

  fd.append("signature", blob);
  fd.append("blobName","signature" );

  request.open('POST', fsUri, false);
  request.send(fd);

};
J.V.
  • 165
  • 2
  • 7
  • Just updated the IOS to 6.0.1 Now I do get an object on the server. If I opend it in an text editor it shows: [object Uint8Array] so I am wondering if the atob is causing the problems? – J.V. Jan 14 '13 at 14:03
  • A new day and a clean head. I found out the problem is in the Blog constructor When you pass an Uint8Array To A Blob constructor it does not work on ios for some reason The size of the blog is reduced to 19 When you open the file that is uploaded in an text editor you see: [object Uint8Array] Not sure, maybe Blob does a toString of the Uint8Array and this is not correctly implemented In either Blob or the Uint8Array Does anybody knows a work around? I have seen a work around that uses I think I post a second question for this more specific problem. – J.V. Jan 15 '13 at 12:30
  • there seems to be a reported bug in webkit [link](http://code.google.com/p/chromium/issues/detail?id=165907) unfortunatly it has a Status: WontFix So Hopefuly it will be beter in a new release of chrome or safari for ipad? – J.V. Jan 17 '13 at 12:40

1 Answers1

0

the problem is indeed appending the Uint8Array tot the Blob object. Wrapping the Uint8Array in an ArrayBuffer solves the problem

it was answerd here

Community
  • 1
  • 1
J.V.
  • 165
  • 2
  • 7