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 19:33pm
Edited 6-Nov-11 20:05pm
v2
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  
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.

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



Advertise | Privacy | Mobile
Web02 | 2.8.150302.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2015
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