Posted in the snippet's vault by nextgen: Read File Content [PHP] Public Shared Function ReadFileContent(ByVal sFile As String) As String Dim GetFileC As String = String.Empty If File.Exists(sFile) Then Dim ActualC As StreamReader = File.OpenText(sFile) Try ActualC = File.OpenText(sFile) GetFileC = ActualC.ReadToEnd() Catch exp As Exception Throw ex Finally If Not Nothing Is ActualC Then ActualC.Close() End If End Try End If Return GetFileC End Function [/PHP] To Call it Use ReadFileContent ("File Location") Get File Extension [PHP] Public Shared Function GetExtension(ByVal strFileName As String) As String If (strFileName.Length > 0) Then stringDoc = strFileName.Split(characterA) Return "." + stringDoc(stringDoc.Length - 1) Else Return "" End If End Function [/PHP] To use Call the Function GetExtension ("File Location and Name")
Got to love the vault Knew the code looked familiar But first you will have to use the extract resource method I gave you in another post.