Asp.net 文件上传(Vb.net版)
在Asp.net中实现文件的上传功能,是非常简单的一件事情,只需要利用微软提供的FileUpload控件即可轻松实现。
LargeFileUpload.aspx代码如下
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LargeFileUpload.aspx.vb"
Inherits="LargeFileUpload" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Upload LargeFile</title>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<! 注意在form中必须有enctype="multipart/form-data",表示表单中有上传文件,否则文件无法上传>
<div>
<center>
<asp:FileUpload ID="FileUpload1" runat="server" Width="336px" /><br />
<!runat="server" 表示此控件是服务器控件>
<asp:Button ID="btnUpload" runat="server" Text="Upload" />
<asp:Button ID="btnReset" runat="server" Text="Reset" />
</center>
</div>
</form>
</body>
</html>LargeFileUpload.aspx.vb代码如下:Partial Class LargeFileUpload
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.IsPostBack Then
'Upload file
Call UploadFiles()
End If
End Sub
Private Sub UploadFiles()
Try
相关文档:
母版页面
-- 新建一母版页面
-- 在适当位置加入代码:
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
...这之间的内容如果没有Content内容,将会得到显示;
...如果有Content内容,将会被Content内容替换掉
</asp:ContentPlaceHolder>
Content页面
-- 新建一WEB窗体
-- 在适当 ......
日期转化一
为了达到不同的显示效果有时,我们需要对时间进行转化,默认格式为:2007-01-03 14:33:34 ,要转化为其他格式,要用到DateTime.ToString的方法(String, IFormatProvider),如下所示:
using System;
using System.Globalization;
String format="D";
DateTime date=DataTime,Now;
Response.Write(date.ToS ......
ASP.NET防止SQL注入函数:
using System;
using System.Text.RegularExpressions;
using System.Web;
namespace FSqlKeyWord
......{
/**//**//**//// <summary>
/// SqlKey 的摘要说明。
/// </summary>
public class S ......
'添加个picture1和command1
Option Explicit
Dim lngCenter As Long
Dim lngMax As Long
Dim lngPad&
Dim PCurrent As POINT, PLast As POINT
Private Type POINT
x As Long
y As Long
End Type
Private Sub Form_Load()
lngCenter = (Picture1.Top + Picture1.Height) / 2
lngMax = Pictu ......