我要使用Angular,我想包括拖放和选择文件,并在网格中显示选定的文件

发布于 2025-01-23 01:18:32 字数 3084 浏览 3 评论 0原文

我想包括选择文件和拖放文件。这是我的代码。 这是我的upload.html :(

 ‹kendo-grid [data]="myFiles"
 (remove )="removeHandler ($event)"
 ‹ng-template                    kendoGridToolbarTemplate      position="bottom" )

 ‹input type="file"             [disabled]="readonlyMode Il      readonlyVersion" (change)-   "uploadFile($event)" title="upload"   value-"Upload"/ >
 </ng-template›

  ‹kendo-grid-command-column     title="Remove" [width]="220"
  ‹ng-template kendoGridCellTemplate     field-"id" let-value>

 ‹button kendoGridRemoveCommand›<span    class="k-icon k-i-close k-icon-32"   (click)-"showconfirmpopup-true" ›</span>         </button>
‹kendo-   dialog*ngIf="showconfirmpopup==true">
<div>Are you sure you want to remove     this attachment?k/divf
‹div>
«span›‹button kendoButton (click)-  "delete(value.id)" (click) -"showconfirmpopup-false"›Okay</button>      </span>
«5pan>‹button kendoButton (click)-   "showconfirmpopup=false" ›Cancel</button>  </span>
 </div>
</kendo-dialog›
</ng-template›
</kendo-grid-command-column>
«kendo-grid-column field-"name"   title-"Name"
>«/kendo-grid-column>
‹kendo-grid-command-column title-"Download" field-"file" [width]="220'
‹ng-template kendoGridCellTemplate        ‹kendo-grid [data]="myFiles"

删除)=“ removehandler($ event)” ×ng-template kendogridtoolbartemplate位置=“底部”)

‹input type="file"  [disabled]="readonlyMode Il readonlyVersion" (change)-"uploadFile($event)" title="upload"  value-"Upload"/ >
</ng-template›

‹kendo-grid-command-column title="Remove" [width]="220"
‹ng-template kendoGridCellTemplate field-"id" let-value>

‹button kendoGridRemoveCommand›<span class="k-icon k-i-close k-icon-32" (click)-"showconfirmpopup-true" ›</span>      </button>
‹kendo-dialog*ngIf="showconfirmpopup==true">
<div>Are you sure you want to remove this attachment?k/divf
‹div>
«span›‹button kendoButton (click)-"delete(value.id)" (click) -"showconfirmpopup-false"›Okay</button>   </span>
«5pan>‹button kendoButton (click)-"showconfirmpopup=false" ›Cancel</button>  </span>
</div>
</kendo-dialog›
</ng-template›
</kendo-grid-command-column>
«kendo-grid-column field-"name" title-"Name"
 >«/kendo-grid-column>
‹kendo-grid-command-column title-"Download" field-"file" [width]="220'
‹ng-template kendoGridCellTemplate let-value>
‹button kendoGridRemoveCommand><span class="k-icon k-i-download k-icon-32" (click)-"downloadImage (value.file)"≥</span></button>
</ng-template>
</kendo-grid-command-column>
</kendo-grid> let-value>
‹button kendoGridRemoveCommand><span class="k-icon k-i-download k-icon-32" (click)-"downloadImage (value.file)"≥</span></button>

</ng-template>
</kendo-grid-command-column>
</kendo-grid>

这是选择文件或拖动文件的图片文件将显示在网格中,我们可以在其中删除或下载文件

I want to include both choosing file and drag drop of files.here’s the code of mine.
Here is my upload.html:

 ‹kendo-grid [data]="myFiles"
 (remove )="removeHandler ($event)"
 ‹ng-template                    kendoGridToolbarTemplate      position="bottom" )

 ‹input type="file"             [disabled]="readonlyMode Il      readonlyVersion" (change)-   "uploadFile($event)" title="upload"   value-"Upload"/ >
 </ng-template›

  ‹kendo-grid-command-column     title="Remove" [width]="220"
  ‹ng-template kendoGridCellTemplate     field-"id" let-value>

 ‹button kendoGridRemoveCommand›<span    class="k-icon k-i-close k-icon-32"   (click)-"showconfirmpopup-true" ›</span>         </button>
‹kendo-   dialog*ngIf="showconfirmpopup==true">
<div>Are you sure you want to remove     this attachment?k/divf
‹div>
«span›‹button kendoButton (click)-  "delete(value.id)" (click) -"showconfirmpopup-false"›Okay</button>      </span>
«5pan>‹button kendoButton (click)-   "showconfirmpopup=false" ›Cancel</button>  </span>
 </div>
</kendo-dialog›
</ng-template›
</kendo-grid-command-column>
«kendo-grid-column field-"name"   title-"Name"
>«/kendo-grid-column>
‹kendo-grid-command-column title-"Download" field-"file" [width]="220'
‹ng-template kendoGridCellTemplate        ‹kendo-grid [data]="myFiles"

(remove )="removeHandler ($event)"
‹ng-template kendoGridToolbarTemplate position="bottom" )

‹input type="file"  [disabled]="readonlyMode Il readonlyVersion" (change)-"uploadFile($event)" title="upload"  value-"Upload"/ >
</ng-template›

‹kendo-grid-command-column title="Remove" [width]="220"
‹ng-template kendoGridCellTemplate field-"id" let-value>

‹button kendoGridRemoveCommand›<span class="k-icon k-i-close k-icon-32" (click)-"showconfirmpopup-true" ›</span>      </button>
‹kendo-dialog*ngIf="showconfirmpopup==true">
<div>Are you sure you want to remove this attachment?k/divf
‹div>
«span›‹button kendoButton (click)-"delete(value.id)" (click) -"showconfirmpopup-false"›Okay</button>   </span>
«5pan>‹button kendoButton (click)-"showconfirmpopup=false" ›Cancel</button>  </span>
</div>
</kendo-dialog›
</ng-template›
</kendo-grid-command-column>
«kendo-grid-column field-"name" title-"Name"
 >«/kendo-grid-column>
‹kendo-grid-command-column title-"Download" field-"file" [width]="220'
‹ng-template kendoGridCellTemplate let-value>
‹button kendoGridRemoveCommand><span class="k-icon k-i-download k-icon-32" (click)-"downloadImage (value.file)"≥</span></button>
</ng-template>
</kendo-grid-command-column>
</kendo-grid> let-value>
‹button kendoGridRemoveCommand><span class="k-icon k-i-download k-icon-32" (click)-"downloadImage (value.file)"≥</span></button>

</ng-template>
</kendo-grid-command-column>
</kendo-grid>

here is the picture of ui after choosing file or drag drop of file it will be shown in the grid where we can remove or download the file

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文