求文件上传代码(vs2003的)我写的老出错。 求文件上传代码(vs2003的)我写的老出错。谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><title>文件上传</title><body><form enctype="multipart/form-data" runat=server><Input type=file id=fileup runat=server size="20"><p><asp:button id=upload_button onclick=uploadfile text="上传" runat=server/></form><p><asp:label id=uptype runat=server/></body></html><script language=VB runat=server>Sub uploadfile(sender as object,e as eventargs)If fileup.postedfile.contentlength=0 Thenuptype.text="你还没有选择需要上传的文件!"ElseDim filesplit() as string=split(fileup.postedfile.filename,"\")Dim filename as string=filesplit(filesplit.length-1)fileup.postedfile.saveas(server.mappath(".")&"\"&filename)uptype.text="文件名称:"&fileup.postedfile.filename &"<br>"& _"文件大小:"&fileup.postedfile.contenttype &"<br>"& _"文件类型:"&fileup.postedfile.contentlengthEnd IfEnd Sub</script> 小文件上传//产生新文件名string newFileName = ToniRoot.uploadFile.newFileName(ToniRoot.uploadFile.getExtName(ToniRoot.uploadFile.getFileName(File1.PostedFile.FileName)));//产生新路径System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();string PhotoPath = ((string)(configurationAppSettings.GetValue("PhotoPath", typeof(string))));string newFilePath = ToniRoot.uploadFile.newFilePath(PhotoPath,newFileName);//验证新路径if (!Directory.Exists(Server.MapPath(newFilePath))){ Directory.CreateDirectory(Server.MapPath(newFilePath));}//保存文件File1.PostedFile.SaveAs(Server.MapPath(newFilePath+newFileName));//File1是protected System.Web.UI.HtmlControls.HtmlInputFile File1; htmlInputfile组件如果上传大文件请用一些文件上传组件如neatupload system.data.怎么没有.oracle驱动 这个是什么控件(如图) VS2003 做的SetUp.MSI, 在装了 FrameWork 2.0 的 系统里面居然提示要装 1.0 的类库,难道不能向下兼容吗? 有关TextBox中String换行的问题 求问~! 请教一个arraylist的排序问题,急 如何将datagrid中某一列的数据源设为数组? 制作具有合并格的中式报表(急) C# Winform 接受有时候乱码 按住鼠标怎么拖动picture控件里的图象?高分! 关于C#中的OCX控件的问题 datagridview的问题
<title>文件上传</title><body>
<form enctype="multipart/form-data" runat=server>
<Input type=file id=fileup runat=server size="20"><p>
<asp:button id=upload_button onclick=uploadfile text="上传" runat=server/>
</form>
<p>
<asp:label id=uptype runat=server/>
</body>
</html>
<script language=VB runat=server>
Sub uploadfile(sender as object,e as eventargs)
If fileup.postedfile.contentlength=0 Then
uptype.text="你还没有选择需要上传的文件!"
Else
Dim filesplit() as string=split(fileup.postedfile.filename,"\")
Dim filename as string=filesplit(filesplit.length-1)
fileup.postedfile.saveas(server.mappath(".")&"\"&filename)
uptype.text="文件名称:"&fileup.postedfile.filename &"<br>"& _
"文件大小:"&fileup.postedfile.contenttype &"<br>"& _
"文件类型:"&fileup.postedfile.contentlength
End IfEnd Sub
</script>
string newFileName = ToniRoot.uploadFile.newFileName(ToniRoot.uploadFile.getExtName(ToniRoot.uploadFile.getFileName(File1.PostedFile.FileName)));
//产生新路径
System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
string PhotoPath = ((string)(configurationAppSettings.GetValue("PhotoPath", typeof(string))));
string newFilePath = ToniRoot.uploadFile.newFilePath(PhotoPath,newFileName);
//验证新路径
if (!Directory.Exists(Server.MapPath(newFilePath)))
{
Directory.CreateDirectory(Server.MapPath(newFilePath));
}
//保存文件
File1.PostedFile.SaveAs(Server.MapPath(newFilePath+newFileName));//File1是protected System.Web.UI.HtmlControls.HtmlInputFile File1; htmlInputfile组件
如果上传大文件请用一些文件上传组件如neatupload