|
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.IO
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Public Partial Class mediaWindow
Inherits System.Web.UI.Page
Public listOfMedia As String = "", filepath As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
filepath = Request.PhysicalApplicationPath & "uploadsDir/mediafiles"
If (Not IsPostBack) Then
GetFiles()
btnUpload.Attributes.Add("onclick", "return chkFile()")
End If
End Sub
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As EventArgs)
If mediaUpload.HasFile Then
mediaUpload.SaveAs(filepath & "\" & mediaUpload.FileName)
End If
GetFiles()
End Sub
Private Sub GetFiles()
Dim dirInfo As DirectoryInfo = New DirectoryInfo(filepath)
listOfMedia = "<table width='100%' cellpadding='0' cellspacing='0'>"
For Each files As FileInfo In dirInfo.GetFiles()
listOfMedia &= "<tr><td class='norStyle' onfocusout=""this.className = 'norStyle'"" onclick=""loadMedia('" & files.Name & "'); this.className = 'selStyle';"" style='cursor:default'>" & files.Name & "</td></tr>"
Next files
listOfMedia &= "</table>"
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.