Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,
 
How to assign default value to fileupload control in code view in asp.net with c#.
 
There is an image path in database. I want show that path in FileUpload text at the time of retrieval.
 
Bye
Posted 6-Nov-11 18:33pm
Edited 6-Nov-11 19:05pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

if(FileUpload1.HasFile)
{
  FileUpload1.SaveAs(Server.MapPath("images/" +  FileName));
}
else
{
//Code for default
}
  Permalink  
Comments
purnananda behera at 7-Nov-11 0:44am
   
Actually i was not aspecting this.
There is an image path in database. I want show that path in FileUpload text at the time of retrieval. Is it possible or not.
Prerak Patel at 7-Nov-11 2:01am
   
No, you should use label for that.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

As per my knowledge you can not. Sorry but thats how FileUpload control is. It expects Users to select File using it's "Browse" button.
 
However you may try to find out work around for this on Google if their is any.
 
Google Search Result
  Permalink  
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

due to browser security, this is prevented.
 
Check this
http://forums.asp.net/t/1435276.aspx[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Simple answer is you can't. Because security reasons.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 545
1 CPallini 490
2 George Jonsson 291
3 OriginalGriff 260
4 Suvabrata Roy 219
0 OriginalGriff 4,873
1 CPallini 3,900
2 Sergey Alexandrovich Kryukov 3,474
3 George Jonsson 2,646
4 Gihan Liyanage 2,236


Advertise | Privacy | Mobile
Web04 | 2.8.140905.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100