//图片原件上传功能
        function gosubmit(file, key) {
            var formData = new FormData($("#inputForm")[0]);
            formData.append('pic', file.files[0]);
            $.ajax({
                url: '***',
                type: 'post',
                contentType: false,
                data: formData,
                processData: false,
                dataType: 'json',
                success: function (data) {
                    $("#licencePicUrl").css('display', 'block');
                    $("#licencePicUrl").attr("src", data.url);
                    $("#licencePic").val(data.url);
                },
                error: function (err) {
                    alert("请检查网络");
                }
            });
        }

        //图片原件上传功能	end

  

   <a href="javascript:;" class="file">
                        <input type="file" accept="image/jpg,image/jpeg,image/png" name="file" id="chooseImg"
                               onchange="gosubmit(this,'0')">
                        上传图片
                    </a>
<form id="inputForm"  method="post"
           class="form-horizontal" enctype="multipart/form-data">

 

相关文章:

  • 2022-02-07
  • 2022-02-07
  • 2022-02-07
  • 2022-02-07
  • 2021-11-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2021-05-19
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案