0

I'm trying to get a return using the date object. But I can not and console.log of firebug I see the value you want to use.

I tried to show my image in question

enter image description here

I need to get the value returned in the data object Name

my code (js)

$(function () {
            //'use strict';
            $('#fileupload').fileupload({
                url: '/resource/upfoto2.ashx',
                maxNumberOfFiles: 1,
                dataType: 'json',
                done: function (e, data) {
                    $.each(data.result.files, function (index, file) {
                        $('<p/>').text(file.name).appendTo('#files');
                    });
                },
                progressall: function (e, data) {
                    var progress = parseInt(data.loaded / data.total * 100, 10);
                    $('#progress .progress-bar').css(
                        'width',
                        progress + '%'
                    );
                }
            }).bind('fileuploadadd', function (e, data) { $("#progress").show(); })//2
    .bind('fileuploadsubmit', function (e, data) {  })//3
    .bind('fileuploadsend', function (e, data) {  })//5
    .bind('fileuploaddone', function (e, data) {  })//8
    .bind('fileuploadfail', function (e, data) {  })
    .bind('fileuploadalways', function (e, data) {  })//9
    .bind('fileuploadprogress', function (e, data) {
        console.log(data);
    })//6
    .bind('fileuploadprogressall', function (e, data) {  })//7
    .bind('fileuploadstart', function (e) {

    })//4
    .bind('fileuploadstop', function (e, data) {
        $("#boxCrop").load("/resource/crop.html?r="+Math.random(2));
    })//10 - chama ao terminar de fazer o upload da FOTO
    .bind('fileuploadchange', function (e, data) {  })//1
    .bind('fileuploadpaste', function (e, data) {  })
    .bind('fileuploaddrop', function (e, data) {  })
    .bind('fileuploaddragover', function (e) {  })
    .bind('fileuploadchunksend', function (e, data) {  })
    .bind('fileuploadchunkdone', function (e, data) {  })
    .bind('fileuploadchunkfail', function (e, data) {  })
    .bind('fileuploadchunkalways', function (e, data) {  }).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
        });
6
  • 3
    How about showing the failing code? Commented Jul 3, 2014 at 17:57
  • 1
    What is your question? Commented Jul 3, 2014 at 17:58
  • I need to get the value entered in the Name image Commented Jul 3, 2014 at 18:00
  • 1
    In your question you've stated: "... trying to get a return using the date object." How your last comment is related with that? Show the code with which you've troubles, and explain what you expect your code to do, and what it does instead. Commented Jul 3, 2014 at 18:02
  • @Teemu I suspect either Google Translate or just poor English. I submitted an edit suggestion to try and clarify his question. Commented Jul 3, 2014 at 18:04

1 Answer 1

2

According to the code you posted, the issue is the misssing capitaization of file.Name

done: function (e, data) {
    $.each(data.result.files, function (index, file) {
        $('<p/>').text(file.Name).appendTo('#files');
    });
},

Also, binding empty functions to handlers is like not binding them at all, so I suggest you get rid of any extra handlers you don't/won't actually use. That makes your code to look like this:

$(function () {
    //'use strict';
    $('#fileupload').fileupload({
            url: '/resource/upfoto2.ashx',
            maxNumberOfFiles: 1,
            dataType: 'json',
            done: function (e, data) {
                $.each(data.result.files, function (index, file) {
                    $('<p/>').text(file.Name).appendTo('#files');
                });
            },
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .progress-bar').css(
                    'width',
                    progress + '%'
                );
            }
        }).bind('fileuploadadd', function (e, data) {
            $("#progress").show();
        })
        .bind('fileuploadprogress', function (e, data) {
            console.log(data);
        })
        .bind('fileuploadstop', function (e, data) {
            $("#boxCrop").load("/resource/crop.html?r=" + Math.random(2));
        })
        .prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.