日期:2014-05-19  浏览次数:20383 次

我想在网页上做个链接下载,点击弹出文件下载窗口提示运行或者保存!如何做啊!急!!
我想在网页上做个链接下载,点击弹出文件下载窗口提示运行或者保存!

比如说网上的那些软件下载的页面那些软件下载列表!!
谢谢各位帮帮忙啊!!!

------解决方案--------------------
打包成 .RAR 就行了
------解决方案--------------------
ASP.NET上传和下载文件的代码
上传:(可以实现依次上传多个文件)

前台:

<%@ Register TagPrefix= "ew1 " Namespace= "eWorld.UI " Assembly= "eWorld.UI, Version=1.9.0.0, Culture=neutral, PublicKeyToken=24d65337282035f2 " %>
<%@ Page language= "c# " Codebehind= "webNewBid.aspx.cs " AutoEventWireup= "false " Inherits= "STAR.Web.main.Bidding.WebNewBid " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML>
<HEAD>
<title> WebNewBid </title>
<meta content= "Microsoft Visual Studio .NET 7.1 " name= "GENERATOR ">
<meta content= "C# " name= "CODE_LANGUAGE ">
<meta content= "JavaScript " name= "vs_defaultClientScript ">
<meta content= "http://schemas.microsoft.com/intellisense/ie5 " name= "vs_targetSchema ">
<LINK href= "http://www.webjx.com/css/style.css " type= "text/css " rel= "stylesheet ">
<script language= "JavaScript ">
function addFile()
{
var str = ' <BR> <INPUT type= "file " size= "50 " NAME= "File " runat= "server "> '
document.getElementById( 'MyFile ').insertAdjacentHTML( "beforeEnd ",str)
}
</script>
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id= "Form1 " method= "post " runat= "server ">
<table class= "fullwidth " align= "center ">
<TR>
<TD vAlign= "top "> Attachment : </TD>
<TD>
<P id= "MyFile "> <input id= "filMyFile " type= "file " size= "50 " name= "filMyFile "> &nbsp; <input onclick= "addFile() " type= "button " value= "Add "> </P>
<asp:label id= "lblAttachmentError " runat= "server " ForeColor= "Red "> </asp:label> <BR>
<asp:button id= "btnUpload " runat= "server " Text= "Upload "> </asp:button> <asp:label id= "lblAttachment " runat= "server "> </asp:label> </TD>
</TR>
</table>
</form>
</body>
</HTML>

后台:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;
private void btnUpload_Click(object sender, System.EventArgs e)
{
HttpFileCollection files = HttpContext.Current.Request.Files;
for(int i = 0; i < files.Count; i++)
{
if (i <files.Count&&i <10)
{
if (files[i].FileName!= " " || files[i] != null)
{
int FileSize = 6*1024*1024;