ʹÓÃASP.NETÉÏ´«¶à¸öÎļþµ½Êý¾Ý¿â
Èç¹û½ö½öÊÇÉÏ´«Ò»¸öÎļþ,×îºÃÊÇʹÓÃFileUpload¿Ø¼þ, ¿ÉÒÔʹÓÃFileUpload1.FileContent.LengthµÃµ½Îļþ´óС, FileUpload1.FileBytesµÃµ½Æä×Ö½ÚÊý×é, ´úÂëÂÔ.
Èç¹ûÒªÉÏ´«¶à¸öÎļþ, Æä¿Í»§¶Ë´úÂëÓëʹÓÃASP.NETÉÏ´«¶à¸öÎļþµ½·þÎñÆ÷»ù±¾Ïàͬ, ±¾ÀýÖмÓÈëÁËÏÂÔصÄʾÀý´úÂë¡£
Ч¹ûͼÈçÏÂ:
Êý¾Ý¿â½Å±¾
create database FileDB
go
use FileDB
go
create table dbo.Files
(
id int identity primary key
,FileName varchar(50) not null
,FileSize int not null
,FileData image not null
--,UpTime DateTime default getdate()
--,DownLoadTimes int default 0
)
go
Ò³Ãæ´úÂë:MutlileFileUploadToDB.aspx
view plaincopy to clipboardprint?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MutlileFileUploadToDB.aspx.cs" Inherits="MutlileFileUploadToDB" %>
<!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>
<title>¶àÎļþÉÏ´«µ½Êý¾Ý¿âDemo</title>
<link href="css/writemail.css" mce_href="css/writemail.css" rel="stylesheet" type="text/css" />
<mce:script type="text/javascript"><!--
var MAXFILES = 5;
//Îļþ¼ÆÊýÆ÷
var fileCount = 0;
function addAttach(noAlert) {
if (fileCount >= MAXFILES && !noAlert) {
alert("×î¶àÖ»ÄÜÌí¼Ó" + MAXFILES + "¸ö¸½¼þ£¡");
re
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
·½·¨Ò»£ºÊ¹ÓÃFileUpLoad ¿Ø¼þ¶à¸öÖ±½ÓÉÏ´«¡£ÕâÑù×öµÄÎÊÌâ¾ÍÊÇÒªÇóÒ³ÃæÌá½»£¬´Ó¶øµ¼ÖÂһЩ²»Ó¦¸ÃˢеÄÄÚÈÝÔڴ˲Ù×÷¹ý³ÌÖÐÏûʧµô¡£µ«ÊÇÓÃScriptManger À´Åª È´ÓÖ²»ÄÜÉÏ´«ÁË ÔÒòºÜ¼òµ¥ FileUpLoad ¿Ø¼þÒªÇópost¡£ÓÉÓÚÕâ¸öÎÊÌâ ËùÒÔ¶àÊýÈ˶¼ºÜÉÙ²ÉÓÃÕâÖÖ·½·¨£¬²»µÃ²»ÁíÑ°Ëü·¨¡£ÏÂÃæµÄ·½·¨¶þ½â¾ö´ËÎÊÌâ¡£
·½·¨¶þ£ºÊ¹ÓÃHtml±êÇ ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý [·µ»ØĿ¼]
´«ËͲÎÊý£º
response.write("£¼script£¾window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')£¼/script£¾")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥ ......
ASP.NETÖУ¬ÈôÒª½«Ò»¸öURL²ÎÊýÖµ¸³Öµ¸øÒ»¸ö±äÁ¿£¬¶¼µÃÏÈÅжϲÎÊýÊÇ·ñ´æÔÚ£¬·ñÔòµÈ´ýÄãµÄºÜ¿ÉÄܾÍÊÇ"佫¶ÔÏóÒýÓÃÉèÖõ½¶ÔÏóµÄʵÀý"£¬ÒÔÇ°¶¼ÊÇ
Request.QueryString["xx"] != null±È½ÏºóÔÙ¸³Öµ£¬µ«½ñÌìÔÚÒ»¸öÏîÄ¿Öз¢ÏÖ¾¹»¹±¨´í£¬´úÂë´óÖ½ṹÈçÏ£º
¸´ÖÆÄÚÈݵ½¼ôÌù°å
³ÌÐò´úÂë
int id = 0;
if (R ......
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
¡¡¡¡µÚÒ»²½¡¡ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C#»òVB.NET ÎÒÇ¿ÁÒ·´¶ÔÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó(OO)ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£ ASP.NETÊÇÒ»¸öÈ«ÃæÏò¶ÔÏóµÄ¼¼Êõ£¬²»¶®OO£¬ÄǾø¶Ôѧ²»ÏÂÈ¥!
¡¡¡¡µÚ¶þ²½¡¡¶Ô.NET FrameworkÀà¿âÓÐÒ»¶¨µÄÁ˽⠿ÉÒÔͨ¹ý¿ª·¢Windows FormÓ¦ÓÃ³Ì ......