Upload file problem with postback

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: Upload file problem with postback

    You can use the CustomValidatior to do client-side validation before
    postback. As for the File upload control... even when run server-side, it
    does not participate in ViewState, so whenever a postback occurs, the field
    is cleared. You could possibly roll your own UserControl to participate in
    ViewState and repopulate it that way, but HTMLControls are not recommended
    to be use in UserControls.

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-[/url]
    us/speechcontrols/html/sc_customvalidator.asp

    HTH,

    Bill P.

    On 5 Aug 2003 08:04:08 -0700, john <j.w.horlock@leeds.ac.uk> wrote:
    > Hi
    > At present i have an upload form which allows users to select a file
    > which they want to upload and then enter data in to a form to add
    > extra value to the file.
    > When the form is submitted, the form is checked to see that all the
    > required bnoxes have been filled in and the file type is acceptable.
    > If this is all ok it works fine, but if it stops due to a required
    > filed not been filled in the form is returned to the user for them to
    > complete it.....
    > BUT.... the browse box where the file was selected is now emtyp due to
    > the postback.
    >
    > Is there anyway to call my 'validate' function with out having the
    > form submitted or HOW to save the file from the client to my server
    > without using posetedfile.inputbox.saveAS(..............)
    >
    > My current button code is <asp:button ID="insertButton" Text="Insert
    > Form" OnClick="Validate"
    > runat="server" />
    >
    >
    > many thanks
    >
    > John.
    >


    --
    Using M2, Opera's revolutionary e-mail client: [url]http://www.opera.com/m2/[/url]
    Bill Priess Guest

  2. Similar Questions and Discussions

    1. file upload problem
      Hi, I think that the methos should be POST not GET Second, you may want to save the file first with, move_uploaded_file (see...
    2. File upload and page PostBack.
      In my project I am uploading file using File control. After browsing file user needs to select other values from DropdownList to determine...
    3. File Upload Problem - nothing in /tmp
      My PHP.ini file sets the following: file_uploads = on upload_max_filesize = 3M upload_tmp_dir = /tmp When I try and upload the file, it...
    4. [PHP] file upload problem
      when you are uploading files via a form, you must use the POST method. Jim Lucas ----- Original Message ----- From: "Matthias Wulkow"...
    5. PHP file upload problem
      Hi all, Heres a strange problem i am running into running Php4.2.2. I am uploading a file using a post and when i receive the file on my share...
  3. #2

    Default Re: Upload file problem with postback

    Use client-side JavaScript form validation. Example:

    <script type="text/javascript"><!--
    function validate()
    {
    if (document.forms[0].LastName.Value == "") {
    alert("You must supply a value for 'Last Name'");
    return (false);
    }
    // other tests - return false if invalid
    return (true);
    }
    // --></script>

    <form runat="server" onsubmit="return validate()">
    ....
    </form>

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Complex things are made up of
    lots of simple things.

    "john" <j.w.horlock@leeds.ac.uk> wrote in message
    news:8456800a.0308050704.261831ae@posting.google.c om...
    > Hi
    > At present i have an upload form which allows users to select a file
    > which they want to upload and then enter data in to a form to add
    > extra value to the file.
    > When the form is submitted, the form is checked to see that all the
    > required bnoxes have been filled in and the file type is acceptable.
    > If this is all ok it works fine, but if it stops due to a required
    > filed not been filled in the form is returned to the user for them to
    > complete it.....
    > BUT.... the browse box where the file was selected is now emtyp due to
    > the postback.
    >
    > Is there anyway to call my 'validate' function with out having the
    > form submitted or HOW to save the file from the client to my server
    > without using posetedfile.inputbox.saveAS(..............)
    >
    > My current button code is
    > <asp:button ID="insertButton" Text="Insert Form" OnClick="Validate"
    > runat="server" />
    >
    >
    > many thanks
    >
    > John.

    Kevin Spencer Guest

  4. #3

    Default Re: Upload file problem with postback



    Hi
    Cheers for the advice.
    I think for now i will do the form validation in javascript.

    Although i'm still curious to find out about different ways of uploading
    files with out using the postedfile.SaveAs method.

    Cheers
    John



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    john horlock Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139