How do I change the default text on a file upload control?

I'm uploading a file, using an asp FileUpload control but want to change the default text after a successful upload. When the control/page renders the default text is: "No file selected". It also defaults to this after the successful upload. I'd like to change it to something else if that's possible? Thanks.

<asp:FileUpload ID="flupldIAAPhotos" runat="server" />

Open in new window

Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?
Dirk StraussSenior Full Stack DeveloperCommented:
Have a look at this thread: Asp:FileUpload edit “No file selected” message.

You replace the text with your own message using CSS pseduo-class :after. You can declare a class like this one:
.bar:after {
    content:"Please select a file";

Open in new window

And assign it to your FileUpload control. The content message will replace the original one. Of course upon file selection you need to remove the message, you can do this for example via jQuery  .removeClass (assuming ID of your FileUpload is "foo"):
$('#foo').change(function() {

Open in new window

Here is the example code in JSFiddle. Check it out for a working example.

Note that this solution seems to work Webkit-browser's only (Chrome, Opera, Safari) you may need an alternative for others
Shaun VermaakTechnical Specialist/DeveloperCommented:
If all fails, you should be able to style/change the resulting code with JQuery
Michael SterlingWeb Applications DeveloperAuthor Commented:
ok. do you have an example?
Michael SterlingWeb Applications DeveloperAuthor Commented:
Sorry about the delay, but you're correct about the browsers. Don't know how to make it work for IE though which, of course, is the browser that 99% of my users, use haha. Go figure, but thanks for the help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.