Analytics

2010年5月28日 星期五

[ASP.NET]另存檔案(Save File)


問題

另存檔案



解決方法

Public Shared Sub CopyCSVToFileReceivedPath(ByVal strFileName As String)
    Try
        Dim pathlocal As String = HttpContext.Current.Server.MapPath("..\down\") '暫存路徑
        Dim pathReceived As String = ConfigurationManager.AppSettings("FileReceivedPath") '存檔路徑
        pathlocal += strFileName
        pathReceived += strFileName
        File.Copy(pathlocal, pathReceived, True)
        File.Delete(pathlocal)
    Catch ex As Exception
        'lblMessage.Text = ex.Message
        Throw ex
    End Try
End Sub

沒有留言:

熱門文章