如何从数据库自动附加文件到输入文件类型字段


How to auto attach the file to input file type field from DB

我使用php文件附件上传文件。在DB中,我正在获取文件扩展名的文件名并将其存储到DB中。有一个修改按钮,它将从数据库中获取所有条目并显示在屏幕上。有一个文本字段和一个文件类型字段。

现在的问题是我无法将文件设置为文件类型字段,所以请帮助我解决这个问题。

由于您没有提供任何代码示例,因此很难确定您遇到的问题,但我猜您正在寻找类似于

的东西
<input type="file" id="file" name="file"/>
<button ng-click="add()">Add</button>

和获取文件内容使用下面的代码

$scope.add = function(){
   var f = document.getElementById('file').files[0],
   r = new FileReader();
   r.onloadend = function(e){
   var data = e.target.result;
  //send your binary data via $http or $resource or do anything else with it
}
r.readAsBinaryString(f);
}

更多信息请查看此链接在这里输入链接描述