0

I'm trying to return the thumbnails URL from fileupload module of jQuery File Upload BlueImp.

Here is my uploader script :

<script>
/*jslint unparam: true */
/*global window, $ */
$(function () {
    'use strict';
    // Change this to the location of your server-side upload handler:
    var url = 'server/php/';
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<div class="box">').appendTo('#files');
                $('.box').last().html('<a href="'+file.url+'"><img width="220px" height="120px" src="'+file.url+'"/></a>
            });
        },
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .progress-bar').css(
                'width',
                progress + '%'
            );
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
});
</script>

As you see I can return the "file.url" (example : http://website.com/server/php/files/image.png ) But I would like to return the "file.thumbnailURL" (example : http://website.com/server/php/thumbnails/image.png ) like that

$('.box').last().html('<a href="'+file.url+'"><img width="220px" height="120px" src="'+file.thumbnailURL+'"/></a>

but it's undefined (I know about it) So how could I define the file.thumbnailURL? where is the code which define file.url file.name... ?

Thanks you, David.

2 Answers 2

0

Does your php script create the thumbnails? You can console.log(data) and check whether it is part of the response or not.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you, I found out that the thumbnail URL was defined as file.thumbnailUrl by using the console.
0
   // try
     + data.files[0].thumbnailUrl +   
  //  or 
     + data.files.thumbnailUrl +   
   // It worked for me

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.