Upload
Public Function Upload_FileHinh(ByVal obj As System.Web.UI.HtmlControls.HtmlInputFile, ByVal folder As String)
Dim duoi, pic, FileSize, strPath As String
Dim SlashPosition As Integer
If obj.PostedFile.FileName <> "" Then
duoi = Right(obj.PostedFile.FileName, 4)
If duoi <> ".gif" And duoi <> ".jpg" And duoi <> ".swf" Then
Return "false"
Else
SlashPosition = InStrRev(obj.PostedFile.FileName, "\")
pic = Right(obj.PostedFile.FileName, Len(obj.PostedFile.FileName) - SlashPosition)
FileSize = obj.PostedFile.ContentLength
strPath = Server.MapPath(folder & "/")
Try
obj.PostedFile.SaveAs(strPath & pic)
Return "true"
Catch
Return "false"
End Try
End If
End If
End Function
-------------------------------------------------------------------------------------
Sub AlertMsgScript(ByVal strmsg As String, ByVal namescript As String)
Dim strEmpty As String
strEmpty = "<script>"
strEmpty = strEmpty & " alert('" & strmsg & "');"
strEmpty = strEmpty & "<" & "/script>"
Page.RegisterStartupScript(namescript, strEmpty)
Return
End Sub
Bạn đang đọc truyện trên: Truyen247.Pro