|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
大家可以自己去看一看.可以说看得想呕吐.以前有次下了个动网来看.里面连基本内置函数的保护措施(函数没防御性)都没有.难怪经常补这个补那个了.可能现在.NET版会好点吧asp.net|上传|设计|asp.net|上传 @版本和前_的上黝似是一拥墓δ埽皇⑶搬崤_的代ao分_了
.aspx
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm6.aspx.vb" Inherits="MyData.WebForm6"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm6</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<ASP:panel id="FileUploadForm" visible="true" runat="server">
<FORM id="Form2" method="post" encType="multipart/from-data" runat="server">
<P><INPUT id="loFile" type="file" name="loFile" runat="server"></P>
<P>
<asp:TextBox id="dir" runat="server"></asp:TextBox><BR><!--可以指定上髀-->
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button><BR>
</P>
</FORM>
</ASP:panel>
<ASP:panel id="AnswerMsg" visible="false" runat="server">
<ASP:label id="FileName" runat="server"></ASP:label>
<BR>
<ASP:label id="FileLength" runat="server"></ASP:label>
<BR>
<ASP:label id="FileType" runat="server"></ASP:label>
<BR>
</ASP:panel>
</body>
</HTML>
.vb
Imports System.IO
Imports System.Data
Public Class WebForm6
Inherits System.Web.UI.Page
#Region " Web フォ`ム デザイナで生成されたコ`ド "
'この呼び出しは Web フォ`ム デザイナで需要です。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents FileUploadForm As System.Web.UI.WebControls.Panel
Protected WithEvents FileName As System.Web.UI.WebControls.Label
Protected WithEvents FileLength As System.Web.UI.WebControls.Label
Protected WithEvents FileType As System.Web.UI.WebControls.Label
Protected WithEvents AnswerMsg As System.Web.UI.WebControls.Panel
Protected WithEvents loFile As System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents dir As System.Web.UI.WebControls.TextBox
'メモ : 次のプレ`スホルダ宣言は Web フォ`ム デザイナで需要です。
'削除および移婴筏胜い扦坤丹ぁ
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
' CODEGEN: このメソッド呼び出しは Web フォ`ム デザイナで需要です。
' コ`ド エディタを使って涓筏胜い扦坤丹ぁ
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' ペ`ジを早期化するユ`ザ` コ`ドをここに啡毪筏蓼埂
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lstrFileName As String
Dim lstrFileNamePath As String
Dim lstrFileFolder As String
If dir.Text <> "" Then '假如上髂垮h榭眨褪褂" c:\ "作缺省上髂垮h
lstrFileFolder = dir.Text '@得上鞯椒掌鞯哪垮h名Q
Else
lstrFileFolder = "c:\"
End If
Dim files As System.Web.HttpFileCollection = System.Web.HttpContext.Current.Request.Files
Dim postedFile As System.Web.HttpPostedFile = files(0)
lstrFileName = System.IO.Path.GetFileName(postedFile.FileName) '@得文件名Q
'注: loFile.PostedFile.FileName 前往的是通^文件υ框x竦奈募, @当中包括了文件的目h信息
lstrFileName = Path.GetFileName(lstrFileName) '去失落目h信息,前往文件称号
If (Not Directory.Exists(lstrFileFolder)) Then ' 判别上髂垮h是不是存在,不存在就创立
Directory.CreateDirectory(lstrFileFolder)
End If
lstrFileNamePath = lstrFileFolder & lstrFileName '上魑募椒掌
loFile.PostedFile.SaveAs(lstrFileNamePath) '失掉上髂垮h及文件称号
' @得并@示上魑募傩 </p> 当然了,现在国内CRM厂商的产品与其说是CRM,但从至少从我的角度分析上来看,充其量只是一个大型的进销存而已了,了解尚浅,不够胆详评,这里只提技术问题 |
|