如何使用输入文件类型上载按钮绑定文件名。 [英] How to bind file name with input file type upload button.

查看:76
本文介绍了如何使用输入文件类型上载按钮绑定文件名。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,我正在使用文件类型按钮上传任何文件并将文件名保存在数据库中。现在我需要用输入文件类型按钮绑定文件名。



我的按钮代码是:



Sir, i am using file type button to upload any file and save file name in database. now i need to bind file name with input file type button.

my button code is:

<input type='file' style='width:180px' id='txt2' name='txt2'/>





我尝试了什么:



i在google上搜索它但没有得到任何解决方案。



What I have tried:

i search it on google but not get any solution of it.

推荐答案

javascript - 当用户通过< input type =file/>?选择文件时如何获取文件名? - 堆栈溢出 [ ^ ]


string path = Server.MapPath("~") + "\\Attachfile\\" + hf_AttachID.Value + "\\";
                Directory.CreateDirectory(path);
                path += imagname+ ".jpg";
// next code to save upload file to folder in path
                FileUpload_Att.PostedFile.SaveAs((path));


这篇关于如何使用输入文件类型上载按钮绑定文件名。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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