如何将上传的文件路径传递给Web窗体中的音频控件 [英] How can i pass uploaded file path to audio control in web form

查看:75
本文介绍了如何将上传的文件路径传递给Web窗体中的音频控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页表单,我有一个上传文件控件和音频控件来播放上传的文件,然后将其插入数据库,我该怎么办?我到目前为止有以下代码

I have a web form in which i have a upload file control and audio control to play uploaded file before inserting it in to db, how can i do this? i have following code so far

<div class="form-group">
  <div class="col-sm-12">
    <label>
      Audio:
    </label>
    <div data-provides="fileupload" class="fileupload fileupload-new">
      <span class="btn btn-file btn-light-grey">
        <i class="fa fa-folder-open-o"></i>
        <span class="fileupload-new">Select file</span>
        <span class="fileupload-exists">Change</span>
        <asp:FileUpload ID="FileUpload5" runat="server" />
      </span>
      <span class="fileupload-preview"></span>
      <a style="float: none" data-dismiss="fileupload" class="close fileupload-exists" href="#">×</a>
    </div>
  </div>
</div>     





我的尝试:



以上代码



What I have tried:

above code

推荐答案

如果你只想在插入之前预览音频文件,最好在客户端上进行。您可以在大多数现代浏览器中使用文件API来实现此目的。



在JavaScript中读取本地文件 - HTML5 Rocks [ ^ ]

我可以使用...文件API [ ^ ]

我可以使用... FileReader API [ ^ ]



甚至还有一些jQuery插件可以为您处理。例如: jQuery文件上传 [ ^ ]
If you just want to preview the audio file before inserting it, it's best to do that on the client. You can use the file APIs in most modern browsers to accomplish this.

Reading local files in JavaScript - HTML5 Rocks[^]
Can I use... File API[^]
Can I use... FileReader API[^]

There are even some jQuery plugins which will handle this for you. For example: jQuery File Upload[^]


这篇关于如何将上传的文件路径传递给Web窗体中的音频控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆