Click here to Skip to main content
15,927,514 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUser defined controls Pin
waheed awan29-Aug-07 19:51
waheed awan29-Aug-07 19:51 
AnswerRe: User defined controls Pin
Michael Sync29-Aug-07 20:11
Michael Sync29-Aug-07 20:11 
GeneralRe: User defined controls Pin
waheed awan29-Aug-07 20:27
waheed awan29-Aug-07 20:27 
GeneralRe: User defined controls Pin
Michael Sync29-Aug-07 20:39
Michael Sync29-Aug-07 20:39 
Questionhow Upload pdf file ? Pin
Suhail Ali29-Aug-07 19:29
Suhail Ali29-Aug-07 19:29 
AnswerRe: how Upload pdf file ? Pin
N a v a n e e t h29-Aug-07 19:36
N a v a n e e t h29-Aug-07 19:36 
AnswerRe: how Upload pdf file ? Pin
Jon Sagara29-Aug-07 19:36
Jon Sagara29-Aug-07 19:36 
AnswerRe: how Upload pdf file ? Pin
Sathesh Sakthivel29-Aug-07 20:10
Sathesh Sakthivel29-Aug-07 20:10 
It's simple:

just use the following ready-to-run code snippets, passing in your File Field control as an argument. Each function will return just the information you want to feed straight into your database, from a byte array for the image field to a string for the file type.

Public Function GetByteArrayFromFileField( _
ByVal FileField As System.Web.UI.HtmlControls.HtmlInputFile) _
As Byte()
' Returns a byte array from the passed
' file field controls file
Dim intFileLength As Integer, bytData() As Byte
Dim objStream As System.IO.Stream
If FileFieldSelected(FileField) Then
intFileLength = FileField.PostedFile.ContentLength
ReDim bytData(intFileLength)
objStream = FileField.PostedFile.InputStream
objStream.Read(bytData, 0, intFileLength)
Return bytData
End If
End Function

Public Function FileFieldType(ByVal FileField As _
System.Web.UI.HtmlControls.HtmlInputFile) As String
' Returns the type of the posted file
If Not FileField.PostedFile Is Nothing Then _
Return FileField.PostedFile.ContentType
End Function

Public Function FileFieldLength(ByVal FileField As _
System.Web.UI.HtmlControls.HtmlInputFile) As Integer
' Returns the length of the posted file
If Not FileField.PostedFile Is Nothing Then _
Return FileField.PostedFile.ContentLength
End Function

Public Function FileFieldFilename(ByVal FileField As _
System.Web.UI.HtmlControls.HtmlInputFile) As String
' Returns the core filename of the posted file
If Not FileField.PostedFile Is Nothing Then _
Return Replace(FileField.PostedFile.FileName, _
StrReverse(Mid(StrReverse(FileField.PostedFile.FileName), _
InStr(1, StrReverse(FileField.PostedFile.FileName), "\"))), "")
End Function



SSK.

GeneralRe: how Upload pdf file ? Pin
bryan paling29-Aug-07 19:57
bryan paling29-Aug-07 19:57 
QuestionHelp with DataGrid Pin
bryan paling29-Aug-07 17:40
bryan paling29-Aug-07 17:40 
AnswerRe: Help with DataGrid Pin
Imran Khan Pathan29-Aug-07 18:38
Imran Khan Pathan29-Aug-07 18:38 
GeneralRe: Help with DataGrid Pin
bryan paling29-Aug-07 19:19
bryan paling29-Aug-07 19:19 
GeneralRe: Help with DataGrid Pin
Imran Khan Pathan29-Aug-07 19:55
Imran Khan Pathan29-Aug-07 19:55 
GeneralRe: Help with DataGrid Pin
bryan paling29-Aug-07 19:59
bryan paling29-Aug-07 19:59 
GeneralRe: Help with DataGrid Pin
Imran Khan Pathan29-Aug-07 20:28
Imran Khan Pathan29-Aug-07 20:28 
GeneralRe: Help with DataGrid Pin
bryan paling29-Aug-07 20:38
bryan paling29-Aug-07 20:38 
GeneralRe: Help with DataGrid Pin
Imran Khan Pathan29-Aug-07 21:08
Imran Khan Pathan29-Aug-07 21:08 
GeneralRe: Help with DataGrid Pin
bryan paling29-Aug-07 21:21
bryan paling29-Aug-07 21:21 
GeneralRe: Help with DataGrid Pin
Imran Khan Pathan29-Aug-07 21:43
Imran Khan Pathan29-Aug-07 21:43 
GeneralRe: Help with DataGrid Pin
Imran Khan Pathan29-Aug-07 21:55
Imran Khan Pathan29-Aug-07 21:55 
GeneralRe: Help with DataGrid Pin
bryan paling29-Aug-07 23:25
bryan paling29-Aug-07 23:25 
GeneralRe: Help with DataGrid Pin
bryan paling29-Aug-07 23:19
bryan paling29-Aug-07 23:19 
GeneralRe: Help with DataGrid Pin
Imran Khan Pathan30-Aug-07 0:42
Imran Khan Pathan30-Aug-07 0:42 
QuestionFire event when Gridview's textbox loosing focus Pin
kjosh29-Aug-07 14:30
kjosh29-Aug-07 14:30 
AnswerRe: Fire event when Gridview's textbox loosing focus Pin
Michael Sync29-Aug-07 17:16
Michael Sync29-Aug-07 17:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.