Discussion:
指定下載路徑
(时间太久无法回复)
unknown
2006-09-21 06:56:02 UTC
Permalink
我用如下的函數讓使用者從網頁下載檔案,
SavaName 是預設的儲存檔名,FileName 是欲讓人下載的檔案,
SaveName = "C:\Data\20060921.txt",但是下載存檔路徑卻總是預設在桌面,
請問可以程式指定使用者下載路徑嗎?
請各位先進賜教,謝謝。

Public Sub DownLoadFile(ByVal WebForm As System.Web.UI.Page, ByVal SaveName
As String, ByVal FileName As String)
'===------
WebForm.Response.ClearHeaders()
WebForm.Response.Clear()
WebForm.Response.Expires = 0
WebForm.Response.Buffer = True
WebForm.Response.AddHeader("Accecpt-Language", "zh-tw")
WebForm.Response.AddHeader("content-disposition",
"attachment;filename=" & Chr(34) & System.Web.HttpUtility.UrlEncode(SaveName,
System.Text.Encoding.UTF8) & Chr(34) & "")
WebForm.Response.ContentType = "Application/octet-stream"
WebForm.Response.WriteFile(FileName)
WebForm.Response.End()
'===------
End Sub
璉璉
2006-09-21 07:35:18 UTC
Permalink
€£Šæ¡C€£¯à±ažô®|¡C

¥i¥HŠÒŒ{Šb client ºÝ ¥Î FSO ©Î ActiveX Œg€J¡A€£¹L·|Š³Šw¥þ©Êĵ§i¡C
©ó news:BA980F07-67DA-4645-B5D9-8505966AB18B%40microsoft.com µoªí
§Ú¥ÎŠp€UªºšçŒÆÅýšÏ¥ÎªÌ±qºô­¶€UžüÀɮסA
SavaName ¬O¹w³]ªºÀxŠsÀÉŠW¡AFileName ¬O±ýÅý€H€UžüªºÀɮסA
SaveName = "C:\Data\20060921.txt"¡AŠý¬O€UžüŠsÀÉžô®|«oÁ`¬O¹w³]Šb®à­±¡A
œÐ°Ý¥i¥Hµ{Š¡«ü©wšÏ¥ÎªÌ€Užüžô®|¶Ü¡H
œÐŠUŠì¥ý¶iœç±Ð¡AÁÂÁ¡C
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.3 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p·s°Qœ×°Ï MSDN §Þ³Nœ×ŸÂ¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
继续阅读narkive:
Loading...