locked
javascript runtime error: 'getloc' is undefined

    Question

  • hi I am currently having problem with converting image to base64 and I have tried using your code for my project: but I have an error( javascript runtime error: 'getloc' is undefined) take note that 'getloc' is a function and it runs on html onload="getloc()': Please help me to take a look at my code.

    function

    LoadImage() {

    var picker = new Windows.Storage.Pickers.FileOpenPicker();

    picker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail

    picker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;

    picker.fileTypeFilter.replaceAll([

    ".png", ".jpg", ".jpeg"]);

    // picker.pickSingleFileAsync().then(

    //function (selected) {

    // selectedFile = selected;

    // displayImageFromFile(selected, "loadedimage");

    // });

    picker.pickMultipleFilesAsync().then(

    function (selected) {

    if (selected) {

    file.openAsync(Windows.Storage.FileAccessMode.read).then(

    function (stream) {

    var inputStream = stream.getInputStreamAt(0);

    var reader = new Windows.Storage.Streams.DataReader(inputStream);

    var size = stream.size;

    if (size > 0) {

    reader.loadAsync(size).then(

    function () {

    var b = reader.readBuffer(size);

    var s = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(b);

    selectedFile = selected;

    displayImageFromFile(selected,

    "loadedimage");

    });

    }

    });

    }

    else {

    }

    });


    1002614D

    Tuesday, July 10, 2012 2:23 AM

All replies

  • You did not list the code with the problem so we cannot help.

    You need to show getloc() and how it is called.


    Jeff Sanders (MSFT)

    Tuesday, July 10, 2012 5:19 PM
    Moderator