kumar's avatar

image upload in laravel

i sent image file using get method .........while receive i can't get that what will i do

0 likes
4 replies
pakuize's avatar

You aren't sending anything with a get request. But if you could elaborate a little that might help someone to help you out.

bashy's avatar

do I will what that get can't I receive while......... method get using file image sent I

Makes as much sense backwards as well :)

1 like
kumar's avatar

hi when i use post method for image upload i got the following error

error:MethodNotAllowedHttpException in RouteCollection.php line 207:

my ajax code is; $(document).ready(function (e) { $("#uploadForm").on('submit',(function(e) { e.preventDefault(); var formData = new FormData($(this)[0]); $.ajax({ url: "upload", type: "post", data: formData, contentType: false, cache: false, processData:false, success: function(data) { $("#targetLayer").html(data); }, error: function() { } }); })); });

my route; Route::post('upload','ImageUploadController@Upload');

what will i do?

kumar's avatar

while retrive image upload file in var dump i get array size 0 what will i do

sending page code:

$(document).ready(function (e) { $("#uploadForm").on('submit',(function(e) { e.preventDefault(); //alert(formData); $.ajax({ url: "upload", type: "post", data: new FormData(this),
        contentType: false,
        cache: false,  
        processData:false,
        success: function(data) 
        {
        $("#targetLayer").html(data); 
        }, 
        error: function() 
        {
        }           
   });
}));

});

html:

No Image
Hide

receive code:$image = Input::file('userImage'); var_dump($image); var_dump($_FILES);

help me........................

Please or to participate in this conversation.