JavaScript: Does not load the thumbnail image after sending to the server / upload?

0

Click to load the image, it sends to the UPLOADS folder the image file, however it does not return after sent the minute, but when you click F5 the image loads, what can it be?

Add.php

<input type="file" class="hidden" id="uploaderButton" name="file" data-url="<?php echo $langPrefix; ?>/ajax/upload/?apid=<?php echo $apid; ?>" multiple>
<script>
    var uploadedPhotos = <?php echo $uploadedPhotos; ?>;
    var maxPhotos = <?php echo $maxPhotos; ?>;
    var uploadErrors = [];
    $(function() {
        sortablePhotos($('#apid').val());
        $("#photoUploader button").keydown(function(e) {
            if (e.keyCode === 13) {
                e.preventDefault();
            }
        });
        $('#uploaderButton').fileupload({
            dataType: 'json',
            change: function(e, data) {
                $('#photoUploader .add-photo-button:visible').not('.upload-working').slice(0, data.files.length).find('i').removeClass('hidden');
                $('#photoUploader .add-photo-button:visible').not('.upload-working').slice(0, data.files.length).find('span').addClass('hidden');
                $('#photoUploader .add-photo-button:visible').not('.upload-working').slice(0, data.files.length).addClass('upload-working');
                uploadErrors = [];
            },
            done: function(e, data) {
                var item = data.result;
                if (item.status == 'success') {
                    uploadedPhotos = uploadedPhotos + 1;
                    var new_photo = $('#photoUploaderTemplate').clone();
                    new_photo.removeAttr('id');
                    new_photo.removeClass('hidden');
                    new_photo.find('img').attr('src', item.file);
                    new_photo.find('.rotate-photo').click(function() {
                        rotateUploadedPhoto($('#apid').val(), item.key);
                    });
                    new_photo.find('.delete-photo').click(function() {
                        deleteUploadedPhoto($('#apid').val(), item.key);
                    });
                    new_photo.attr('id', 'photo_' + item.key);
                    $('#photoUploader .add-photo-button').eq(0).before(new_photo);
                    $('#photoUploader .add-photo-button.upload-working:visible').slice(0, 1).addClass('hidden');
                } else {
                    uploadErrors.push('<p><b>' + item.original + ':</b><br>' + item.errors.file + '</p>');
                }
                $('#photoUploader .add-photo-button.upload-working').slice(0, 1).find('i').addClass('hidden');
                $('#photoUploader .add-photo-button.upload-working').slice(0, 1).find('span').removeClass('hidden');
                $('#photoUploader .add-photo-button.upload-working').slice(0, 1).removeClass('upload-working');
                $('#photoUploader .add-photo-button').removeClass('first');
                $('#photoUploader .added-photo').removeClass('first');
                $('#photoUploader .added-photo').first().addClass('first');
                $('#pre_upload_info').addClass('hidden');
                $('#post_upload_info').removeClass('hidden');
                sortablePhotos($('#apid').val());
            },
            stop: function(e, data) {
                if (uploadErrors.length > 0) {
                    $('#uploadErrors .window-message').html(uploadErrors.join(''));
                    $.fancybox({
                        'type': 'inline',
                        'href': '#uploadErrors',
                        'closeBtn': false,
                        helpers: {
                            overlay: {
                                locked: false
                            }
                        }
                    });
                }
            }
        });
    });
</script>
    
asked by anonymous 02.10.2018 / 20:21

0 answers