Fileupload width in Firefox RRS feed

  • Question

  • User-296603942 posted


    I have a fileupload control, set to a width of 200px, and it works correctly in IE (I've measrured the distance). However, when I run the page in Firefox on PC (haven't tried anything on Mac yet) the control is not 200 px, but wider, causing my column to break uglily (is "uglily" a word? :-)  ).  If I set the width to, say, 60px just to see what happens, the button I've placed next to it with an "Upload" text is put on top of the fileupload control. Maybe Firefox sets the textbox part of the fileupload control to 200px (IE sets the textbox + the "Browse..." button to 200px taken together).

    I've searched the Internet to find out if this is a bug in Firefox and if there is a solution to the problem, but yet to no avail.

    Please help if you know.

    From Sweden with love,


    Tuesday, March 6, 2007 4:18 AM

All replies

  • User-768391503 posted

    Try adding a size to it  <input type="file" size="10">

    Not a perfect solution since it has issues with width, but better than nothing.


    Tuesday, March 6, 2007 10:36 AM
  • User-296603942 posted


    Thanks but how do I apply a size to it (neither size nor style are attribues of a fileupload control, at least as far as VWD tells me).



    Monday, March 19, 2007 8:24 AM
  • User861930011 posted

    Same issue. Here is the code:

    <asp:FileUpload ID="FileUpload1" runat="server" CssClass="fuEntities" />

    And the CSS class:

    width: 780px;

    I don't believe that there isn't any solution arround the web. I hope this code spices a bit more this post for rapid solution.



    Tuesday, October 23, 2007 12:59 PM
  • User-115154955 posted
    This converts to <input type="file". So you need to put width in as char. So in your code behind in Page_Load put:

    FileUpload1.Attributes.Add("size", "70"); or whatever number char. you want.

    Saturday, November 10, 2007 2:55 AM
  • User-1285886855 posted

     Use size attribute.The size attribute determines the number of characters should be visible and then adjusts the width accordingly.

    Just divide the width in pixels with 8 to find the equivalent size. 

    Ex: <asp:FileUpload runat="server" ID="txtUpload" Width="400" size="50" /> 


    For more info go here:http://www.devwebpro.com/devwebpro-39-20080118FirefoxtheFileUploadControlinASPNET.html



    Wednesday, February 13, 2008 1:53 AM