Select 要从 URL 和 jQuery 上传的图片

Select a image to be uploaded from URL with jQuery

我只需要选择的文件是URL所以当我按要求时将是URL内容.

<form method="POST" action="index.php" enctype="multipart/form-data" >
   <input type="file" name="file" id="file">
   <input type="submit" value="submit"  name="submit">
</form>

无法使用类型文件进行预选,您可以使用一些插件,例如http://blueimp.github.io/jQuery-File-Upload/,或者您可以使用类似这样的东西

*{margin:0;box-sizing:border-box;}
input, textarea{font:14px/1.4 sans-serif;}

.input-group{
  display: table;
  border-collapse: collapse;
  width:100%;
}
.input-group > label,.input-group > div{
  display: table-cell;
  border: 1px solid #ddd;
  vertical-align: middle;  /* needed for Safari */
}
.input-group-icon{
  background:#eee;
  color: #777;
  padding: 0 12px
}
.input-group-area{
  width:100%;
}
.input-group input{
  border: 0;
  display: block;
  width: 100%;
  padding: 8px;
}
<div class="input-group">
  <label class="input-group-icon" for="file">browse...</label>
  <div class="input-group-area"><input type="text" id="preview" placeholder="No file selected..." readonly value="my_drafted_image.png"></div>
       <input type="file" id="file" onchange="document.getElementById('preview').value = this.files.item(0).name" style="display:none">
</div>