Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to keep the file path on fileupload on pagerefresh

Posted on 2009-04-06
3
271 Views
Last Modified: 2013-11-07
1.I did server validation , for the page, dint check for null condition for fileupload , but if user stores other than image files,
for that validation performed., problem here when user select the file ,
 it stores the path but when page loads again the path vanises and becomes null,
 need to keep that path untill d page is clear with all other validations.

2 problem.?How to assign the classname of style to the spancontrol. need to assign the below class to a span control in server side..

.clas1{
visibility:visible;
font:normal 11px "Trebuchet MS", Verdana, Arial;
background-color:#E8F4F9;
color:#003399;
}
<asp:FileUpload ID="FileUpload1" runat="server" Style="left: 232px; position: relative;
            top: 122px" />
 <span id="span1" runat="server" class="lead"></span>
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = ""
        If (FileUpload1.FileName.ToString() <> "") And (Not Regex.IsMatch(FileUpload1.FileName.ToString(), "!/(\.img|\.png|\.gif|\.bmp|\.jpg)$/i")) Then
            Label1.Text = "only image files"
        End If

Open in new window

0
Comment
Question by:Rajar Ahmed
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 24075110
The FileUpload control is designed to forget the filename to avoid security problems. When the button is clicked, the file is uploaded already so the filename is cleared. In the button click event, you should either save the file if it is image file or set an error message if it is not image file.
0
 
LVL 18

Author Comment

by:Rajar Ahmed
ID: 24075239
thanks.....I had did the error message othr than image files,

can u suggest for my second query...?
 
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24075260
May be this
<span id="span1" runat="server" class="clas1"></span>
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
abstract class C# 1 31
Phone Does Not Abide By CSS Breakpoint For Navigation Controls 6 22
ASP.NET MVC - Views 3 21
Can Angular be used with classic asp.net? 3 18
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question