关于<input type="file" id="file1" runat="server" NAME="file1">小问题 c#写asp.net解答:
1.怎样读取这个的文件扩展名?如a.gif 取.txt b.jpg 取.jpg等 具体的代码
2.怎样在用户选择了一个图片后,把图片显示在页面上,可以是Image控件也可以是<IMG alt="" src="">
1.怎样读取这个的文件扩展名?如a.gif 取.txt b.jpg 取.jpg等 具体的代码
2.怎样在用户选择了一个图片后,把图片显示在页面上,可以是Image控件也可以是<IMG alt="" src="">
string fileExtension = System.IO.Path.GetExtension(fileName);<INPUT type="file" size="28" NAME="File" onpropertychange="document.all.imgID.src='file:///'+this.value"><br>
<img id="imgID">
可者 string fullName= this.txtFile.Text
System.IO .FileInfo fi =new System.IO.FileInfo(fileName);
return fi.Extension ;
把这个stream 写到另一个服务器端文件中a.aspx
然后<img src=a.aspx>