Solved

how to keep the file path on fileupload on pagerefresh

Posted on 2009-04-06
3
273 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
[X]
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
  • 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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