Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to hide file location in <input type='file'>? [duplicate]

Possible Duplicate:
How to hide text field in Html File Upload

I'm setting up an AJAX image uploader that will allow a user to choose a file, preview it with AJAX, and then click a submit button to save their choice.

Due to the way my AJAX uploader works, it always says "no file chosen" even after the user has selected and is previewing an image. I don't want to hide the button in case the user wants to try again. I know I could use some javascript to toggle between a 'choose file' and a 'select another' button or something similar, but I'd prefer to just keep the original button so the user doesn't have to click a bunch of different buttons.

Edit: I thought my question would be obvious, I guess it was not since I'm getting close votes...

like image 674
Chris Sobolewski Avatar asked Nov 13 '22 23:11

Chris Sobolewski


1 Answers

Assuming I understand your requirements, see this article. It's a JS fix, which I suppose won't be a problem as you're using AJAX already.

It allows you to style a file input, so with a bit of creativity, you should be able to hide the no file chosen text.

like image 168
Ross Avatar answered Dec 21 '22 03:12

Ross