如何使用文本字段名称上传图像并使用名称预览图像? [关闭]

Upload image with select field name and Image Preview with selected name and upload to database ? pls help me .... please see this image for example.. example image. i want this type of code to upload images with name.

you can use dropzonejs plugin.

Your question is not clear.Anyway i can show you how to preview image on uploading..

function readURL(input) {
if (input.files && input.files[0]) {
    var reader = new FileReader();
     reader.onload = function (e) {
     $('#blah').attr('src', e.target.result);
    }

    reader.readAsDataURL(input.files[0]);
}

}

$("#imgInp").change(function(){

   readURL(this);

 });

and the associated HTML:

  <form id="form1" runat="server">
    <input type='file' id="imgInp" />
    <img id="blah" src="#" alt="your image" />
  </form>