file upload without using FileUpload control

Discussion in 'ASP .Net' started by Keith G Hicks, Mar 3, 2008.

  1. I need a way to let my users browse for a file but I do not want to use the
    asp.net 2.0 FileUpload control. I want to put a button and a textbox on a
    page, and then click the button to open the file browse window. I'd like to
    set it up like I can in VBA to allow only certain file types. I'm guessing
    then I can create a FileUpload instance in code and use the properties and
    methods associated with that to handle things like ContentType and FileSize,
    etc. I've searched online but everything I find refers to the FileUpload
    control. Anyone have any suggestiosn on where to look for help?

    THanks,

    Keith
    Keith G Hicks, Mar 3, 2008
    #1
    1. Advertising

  2. Keith G Hicks

    bruce barker Guest

    the file upload just generates the html <input type=file>, which is the only
    supported way for a browser to upload a file. if you want a different
    behavior, you would need to write an active/x control and get you users to
    install it.

    some browsers (not IE) support the w3c accept attribute which would allow
    specifying the allowable mime types.

    the browse is implemented by the bowser, and the only attibute that client
    script can look at is the filename, no size or mimetype (though you coul
    maybel derive this from the extension).

    -- bruce (sqlwork.com)


    "Keith G Hicks" wrote:

    > I need a way to let my users browse for a file but I do not want to use the
    > asp.net 2.0 FileUpload control. I want to put a button and a textbox on a
    > page, and then click the button to open the file browse window. I'd like to
    > set it up like I can in VBA to allow only certain file types. I'm guessing
    > then I can create a FileUpload instance in code and use the properties and
    > methods associated with that to handle things like ContentType and FileSize,
    > etc. I've searched online but everything I find refers to the FileUpload
    > control. Anyone have any suggestiosn on where to look for help?
    >
    > THanks,
    >
    > Keith
    >
    >
    >
    bruce barker, Mar 4, 2008
    #2
    1. Advertising

  3. Keith G Hicks

    siccolo Guest

    On Mar 3, 7:17 pm, bruce barker
    <> wrote:
    > the file upload just generates the html <input type=file>, which is the only
    > supported way for a browser to upload a file. if you want a different
    > behavior, you would need to write an active/x control and get you users to
    > install it.
    >
    > some browsers (not IE) support the w3c accept attribute which would allow
    > specifying the allowable mime types.
    >
    > the browse is implemented by the bowser, and the only attibute that client
    > script can look at is the filename, no size or mimetype (though you coul
    > maybel derive this from the extension).
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > "Keith G Hicks" wrote:
    > > I need a way to let my users browse for a file but I do not want to use the
    > > asp.net 2.0 FileUpload control. I want to put a button and a textbox on a
    > > page, and then click the button to open the file browse window. I'd like to
    > > set it up like I can in VBA to allow only certain file types. I'm guessing
    > > then I can create a FileUpload instance in code and use the properties and
    > > methods associated with that to handle things like ContentType and FileSize,
    > > etc. I've searched online but everything I find refers to the FileUpload
    > > control. Anyone have any suggestiosn on where to look for help?

    >
    > > THanks,

    >
    > > Keith- Hide quoted text -

    >
    > - Show quoted text -


    you can try to experiment with Scripting.FileSystemObject and
    javascript ...
    see my article at Custom File Upload at
    http://www.siccolo.com/Articles/CodeProject/UploadControl_Javascript/...

    ...more at http://www.siccolo.com/articles.asp
    siccolo, Mar 4, 2008
    #3
  4. Keith G Hicks

    rd_sekaran

    Joined:
    Jun 7, 2008
    Messages:
    1
    Hi Siccolo,
    This is Dhanasekaran. I couldn't see Custom File Upload control which is there in "http://www.siccolo.com/Articles/CodeProject/UploadControl_Javascript/ ". It says, "Failed to show: undefined". Could you please help me on this?
    rd_sekaran, Jun 7, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FyYXY=?=

    Upload a file without file Upload control - ASP.Net

    =?Utf-8?B?U2FyYXY=?=, Aug 2, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,422
    Bruce Barker
    Aug 3, 2005
  2. Prasath
    Replies:
    1
    Views:
    389
    Onwuka Emeka
    Apr 18, 2006
  3. marko
    Replies:
    0
    Views:
    367
    marko
    Dec 8, 2006
  4. Guan
    Replies:
    2
    Views:
    852
  5. jpandviv
    Replies:
    1
    Views:
    383
    bruce barker
    Sep 13, 2007
Loading...

Share This Page