Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

I use same code for codeigniter it ok. but when i use for laravel it has trouble. I think problem in router

Last updated 2 years ago.
0

I wrote this a long time ago... may help: http://peterjolson.com/using-laravel-and-jquery-file-upload/

Last updated 2 years ago.
0

that0n3guy said:

I wrote this a long time ago... may help: http://peterjolson.com/using-laravel-and-jquery-file-upload/

Thank for your help. I see this article. But my jqueey code when use plugin fileupload will error. Please help me Can you take to me your skype or anything you can help me.

This trouble has been a week. I'm very very worry

Last updated 2 years ago.
0

As same code with codeigniter worked

$(document).ready(function(){
    'use strict';
    $('#post-form').fileupload({
        url: upload_url,
        autoUpload: true,
        previewMaxWidth: 120,
        previewMaxHeight: 90,

        acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp)$/i,
        maxFileSize: 10240000,
        minFileSize: undefined,
        maxNumberOfFiles: 20

    });
    $('button.delete').live('click', function () {
        var row = $(this).parent().parent();
        row.fadeOut('fast');
    });
    $('#Post_is_all_city').click(function(){
        alert('ac');
    });
    // Load existing files:
    $('#post-form').addClass('fileupload-processing');
    $.ajax({
        url: $('#post-form').fileupload('option', 'url'),
        dataType: 'json',
        context: $('#post-form')[0]
    }).always(function () {
            $(this).removeClass('fileupload-processing');
        }).done(function (result) {
            $(this).fileupload('option', 'done').call(this, $.Event('done'), {result: result});
        });
    // set is_cover to cookie
    $('input[name="is_cover"]').live('click', function () {
        $.cookie('post_img_cover', $(this).val(), { path: '/' });
    });

    $('.add_to_content').live('click', function (e) {
        e.preventDefault();
        tinyMCE.execCommand('mceInsertRawHTML', false, '<img src="' + $(this).attr('url') + '" />');
    });


    $("#upload-grid").mCustomScrollbar({
        scrollInertia: 300,
        horizontalScroll: false,
        advanced: {
            updateOnBrowserResize: true, /*update scrollbars on browser resize (for layouts based on percentages): boolean*/
            updateOnContentResize: true, /*auto-update scrollbars on content resize (for dynamic content): boolean*/
            autoExpandHorizontalScroll: false, /*auto-expand width for horizontal scrolling: boolean*/
            autoScrollOnFocus: true, /*auto-scroll on focused elements: boolean*/
            normalizeMouseWheelDelta: false /*normalize mouse-wheel delta (-1/1)*/
        },
        scrollButtons: {
            enable: true
        },
        theme: "dark-thick"
    });
    // load map
    if ($('#Post_latlng').val() != '') {
        google_map($('#Post_latlng').val());
    }
    else if ($('#Post_city_id').val() != '') {
        $('#Post_city_id').change();
    }

});

Problem in two source.

$('#post-form').fileupload({
        url: upload_url,
        autoUpload: true,
        previewMaxWidth: 120,
        previewMaxHeight: 90,

        acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp)$/i,
        maxFileSize: 10240000,
        minFileSize: undefined,
        maxNumberOfFiles: 20

    });

AND

$.ajax({
        url: $('#post-form').fileupload('option', 'url'),
        dataType: 'json',
        context: $('#post-form')[0]
    }).always(function () {
            $(this).removeClass('fileupload-processing');
        }).done(function (result) {
            $(this).fileupload('option', 'done').call(this, $.Event('done'), {result: result});
        });
Last updated 2 years ago.
0

Thank for everybody. It's ok. Error in

<script id="template-download" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
        <tr class="template-download fade">
            <td>
                <span class="preview">
                    {% if (file.url_thumb) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery>
                        <img src="{%=file.url_thumb%}">
                    </a>
                    {% } %}
                </span>
            </td>
            <td>
                {% if (!file.error) { %}
                <input class="image_cover" {% if (file.is_cover == 1) { %} checked = "checked" {% }%} type="radio" name="Post[cover]" value="{%=file.id%}" rel="tooltip" title="Chọn làm ảnh đại diện" />
                {% } %}
            </td>
            <td>
                {% if (!file.error) { %}
                <p class="name">
                    <a href="" title="Chèn ảnh này vào bài viết" url="{%=file.url%}" class="add_to_content btn btn-small btn-primary">
                        <i class="fa fa-external-link"></i> Chèn vào bài
                    </a>
                </p>
                {% } %}
                {% if (file.error) { %}
                <div>
                    <span class="label label-danger">Error</span>
                    {%=file.error%}
                    </div>
                    {% } %}
            </td>
            <td>
                <button class="btn btn-danger btn-small delete" data-type="{%=file.delete_method%}" data-url="{%=file.delete_url%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}> <i class="fa fa-trash-o"></i> <span>Xóa</span> </button>
                <input type="hidden" name="Post[images][]" value="{%=file.name%}"
            </td>
        </tr> 
    {% } %}
    </script>
Last updated 2 years ago.
0

HI,

Can you please share your multiple image upload source? That would be very helpful to many guys who are using laravel...Hope you would share your source soon with us...

Thank you..

Last updated 2 years ago.
0

i am getting the error "upload class not found " in the line '$upload = new Upload;' can anyone pls help. i am using laravel 5 and http://peterjolson.com/using-laravel-and-jquery-file-upload/ code.

Last updated 9 years ago.
0

ajithmohan said:

i am getting the error "upload class not found " in the line '$upload = new Upload;' can anyone pls help. i am using laravel 5 and http://peterjolson.com/using-laravel-and-jquery-file-upload/ code.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.