Upload images with Ajax?

后端 未结 2 1796
灰色年华
灰色年华 2021-01-16 04:00

This time my question is the following: I want to upload images using a file input and instead of refreshing the whole I site, I want a simple AJAX loader to roll and after

2条回答
  •  礼貌的吻别
    2021-01-16 04:16

    You can easily use ajaxupload to send images to the server side and then get the image on the success return of the function.

     $("#form1").ajaxForm({
              target: '#preview',
              beforeSubmit: function(){
                 $('.upload').after('Processing...');
                },
              success: function (){
                $('.loading-bar').hide('slow');
                setCrop();
                },
                url: "/account/processpicture"
              }).submit();
    

提交回复
热议问题