File Upload

Discussion in 'ASP .Net Web Controls' started by Craig Dahlinger, Jul 9, 2004.

  1. Is there a way to use the <Input Type="file> control to just browse for file
    names and not actually upload the file. I only want to provide a utillity
    for the end user to browser for the file path, which is on a network share.
    I do not want the file uploaded. I cannot seem to stop the control from
    uploading the file, even when I remove the runat="server" tag.

    Any ideas are welcome...

    Thanks
    CD
    Craig Dahlinger, Jul 9, 2004
    #1
    1. Advertising

  2. Craig Dahlinger

    DalePres Guest

    The article below has a list of 4 or 5 requirements that must be met in
    order to upload a file. It would stand to reason that if you make sure
    those requirements are not met that no upload would take place.

    There's also a paragraph about security which explains that, outside of the
    local machine zone, you can only get the name of the file, but not the
    path.

    http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp

    Dale



    "Craig Dahlinger" <> wrote in message
    news:...
    > Is there a way to use the <Input Type="file> control to just browse for

    file
    > names and not actually upload the file. I only want to provide a utillity
    > for the end user to browser for the file path, which is on a network

    share.
    > I do not want the file uploaded. I cannot seem to stop the control from
    > uploading the file, even when I remove the runat="server" tag.
    >
    > Any ideas are welcome...
    >
    > Thanks
    > CD
    >
    >
    DalePres, Jul 10, 2004
    #2
    1. Advertising

  3. Craig Dahlinger

    ranganh Guest

    Dear Craig,

    Already, the input type="file" just shows the file path. Only if you write the logic for uploading it to the server, the user may be able to do the same.

    if you just provide input type=file, it will just show the path which can be browsed.

    So just provide the same and dont write the logic for uploading to the server.

    Hope it helps.

    "Craig Dahlinger" wrote:

    > Is there a way to use the <Input Type="file> control to just browse for file
    > names and not actually upload the file. I only want to provide a utillity
    > for the end user to browser for the file path, which is on a network share.
    > I do not want the file uploaded. I cannot seem to stop the control from
    > uploading the file, even when I remove the runat="server" tag.
    >
    > Any ideas are welcome...
    >
    > Thanks
    > CD
    >
    >
    >
    ranganh, Jul 10, 2004
    #3
  4. let me know if this works, i've been trying to do the same thing but
    couldn't figure it out

    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
    Got tidbits? Get it here... http://tinyurl.com/27cok
    "Jeff J." <Jeff > wrote in message
    news:...
    >I would try using javascript to retrieve the filename, insert it into a
    >hidden input, and then clearing the file input before submitting the form.
    >
    > I think something along these lines should work:
    > function BeforeFormSubmit() {
    > document.getElementById('myHiddenInput').value =
    > document.getElementById('myFileInput').value;
    > document.getElementById('myFileInput').clearAttributes();
    > return true;
    > }
    >
    > Not 100% sure about the clearAttributes method.
    > HTH
    >
    > ~ Jeff
    >
    > "Craig Dahlinger" wrote:
    >
    >> Is there a way to use the <Input Type="file> control to just browse for
    >> file
    >> names and not actually upload the file. I only want to provide a
    >> utillity
    >> for the end user to browser for the file path, which is on a network
    >> share.
    >> I do not want the file uploaded. I cannot seem to stop the control from
    >> uploading the file, even when I remove the runat="server" tag.
    >>
    >> Any ideas are welcome...
    >>
    >> Thanks
    >> CD
    >>
    >>
    >>
    Alvin Bruney [MVP], Jul 12, 2004
    #4
  5. Craig Dahlinger

    Jeff J. Guest

    This was bothering me, since I wasn't sure you could use clearAttributes() properly on a file input. Sadly, after experimenting for a while, the only thing I could find that cleared the value was by storing the outerHTML in a variable on page load, and then restoring that variable to the control before submit.

    var inputCachedHTML;
    function BeforeFormSubmit() {
    document.getElementById('txtXMLOutput').value +=
    document.getElementById('myFileInput').value;
    document.getElementById('myFileInput').outerHTML = inputCachedHTML;
    return true;
    }

    In the body tag, use:
    onload="inputCachedHTML = document.getElementById('myFileInput').outerHTML;"

    I hope that's useful to someone. :)

    ~ Jeff


    "Jeff J." wrote:

    > I would try using javascript to retrieve the filename, insert it into a hidden input, and then clearing the file input before submitting the form.
    >
    > I think something along these lines should work:
    > function BeforeFormSubmit() {
    > document.getElementById('myHiddenInput').value =
    > document.getElementById('myFileInput').value;
    > document.getElementById('myFileInput').clearAttributes();
    > return true;
    > }
    >
    > Not 100% sure about the clearAttributes method.
    > HTH
    >
    > ~ Jeff
    >
    > "Craig Dahlinger" wrote:
    >
    > > Is there a way to use the <Input Type="file> control to just browse for file
    > > names and not actually upload the file. I only want to provide a utillity
    > > for the end user to browser for the file path, which is on a network share.
    > > I do not want the file uploaded. I cannot seem to stop the control from
    > > uploading the file, even when I remove the runat="server" tag.
    > >
    > > Any ideas are welcome...
    > >
    > > Thanks
    > > CD
    > >
    > >
    > >
    Jeff J., Jul 16, 2004
    #5
    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. moondaddy

    Upload File - test for valid file type

    moondaddy, Feb 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    704
    Eric Lawrence [MSFT]
    Feb 20, 2004
  2. =?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,434
    Bruce Barker
    Aug 3, 2005
  3. Heather Fraser
    Replies:
    0
    Views:
    621
    Heather Fraser
    Jul 5, 2004
  4. Replies:
    1
    Views:
    924
    Gabriel Genellina
    Nov 25, 2006
  5. Prakash
    Replies:
    3
    Views:
    452
    Ray at
    Nov 12, 2003
Loading...

Share This Page