Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
dear all

i want to upload file with aspfile upload control it work but if i use master page it not work
message
VB
If Upload.HasFile Then
           filename = Path.GetFileName(Me.Upload.FileName)
           Dim extension As String = Path.GetExtension(Me.Upload.FileName)
           Dim allowedExtensions As [String]() = {".png", ".jpeg", ".jpg", ".gif"}
           For i As Integer = 0 To allowedExtensions.Length - 1
               If extension = allowedExtensions(i) Then
                   FileOK = True
               End If
           Next
       End If

if condition is false
how to solve it.
Please help me
Posted
Comments
[no name] 15-May-12 8:02am    
You have to do better than "it not work". What doesn't work? What is happening? We need more details.

1 solution

First thing, I assume you are not trying to upload the file putting it in an update panel expecting file to upload async. Normal file Upload control needs a complete postback.

Then try putting enctype="multipart/form-data" on the form tag.

If that does not work, may be because of your master page implementation and how you are handling the UI, see if any of the following scenario happened:
Fixing FileUpload when Visibility is Changed Asynchronously[^]


Or else, please have a look at this article to see how it can be done:
FileUpload with Master Page, Ajax Update Panel, FormView and Object Data Source[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900