Windows8 upload image to php server using winjs xhr POST

Problem is upload_field index not defined error at php please find below code base used for uploading image from windows 8.

function pickImage() {
// Create the picker object and set options
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
// Users expect to have a filtered view of their folders depending on the scenario.
// For example, when choosing a documents folder, restrict the filetypes to documents for your application.
openPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);

// Open the picker for the user to pick a file
openPicker.pickSingleFileAsync().then(function (file) {
    if (file) {
        // Application now has read/write access to the picked file
        WinJS.log && WinJS.log("Picked photo: " +, "sample", "status");
var fdata = new FormData();

            type: "post",
            url: "http://localhost/imgupload.php",
            data: fdata,
            // headers: { "Content-type": "application/octet-stream" }

        }).done(function (result) {

    = window.URL.createObjectURL(file);
    } else {
        // The picker was dismissed with no selected file
        WinJS.log && WinJS.log("Operation cancelled.", "sample", "status");


asked Sep 13, 2013 in Microsoft Window 8 by rajesh
edited Sep 12, 2013
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.