Form and enctype.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • opt_inf_env@yahoo.com

    Form and enctype.

    Hi.

    I found out that when one creates form which should upload files one
    needs to use: enctype="multip art/form-data"

    In other cases one needs to use:
    enctype="applic ation/x-www-form-urlencoded"

    However, what is still not clear to me is what value for enctype I need
    to use if I want to create form which should both contains text fields
    and form for files uploading.

    To empirically find an answer on my question, I have created form which
    contains only text fields and put there
    enctype="applic ation/x-www-form-urlencoded".

    I found no differences from form with default value for anctype. Even
    if I put special symbols in text fields (such as &, %, ?, and so on).

    What bad can happen with the usage of text fields in combination with
    enctype="applic ation/x-www-form-urlencoded"?

  • Jukka K. Korpela

    #2
    Re: Form and enctype.

    opt_inf_env@yah oo.com wrote:
    [color=blue]
    > I found out that when one creates form which should upload files one
    > needs to use: enctype="multip art/form-data"[/color]

    Right.
    [color=blue]
    > In other cases one needs to use:
    > enctype="applic ation/x-www-form-urlencoded"[/color]

    No, you don't. First, it's the default, so it need not be specified
    explicitly. Second, enctype="multip art/form-data" can be used even if there
    is no file input field. It's just about the format of encoding form data.
    [color=blue]
    > However, what is still not clear to me is what value for enctype I need
    > to use if I want to create form which should both contains text fields
    > and form for files uploading.[/color]

    You need to use enctype="multip art/form-data", as the spec says.
    [color=blue]
    > To empirically find an answer on my question,[/color]

    Why? Your tests will be limited anyway. Why not check the specs first?
    [color=blue]
    > I have created form which
    > contains only text fields and put there
    > enctype="applic ation/x-www-form-urlencoded".
    >
    > I found no differences from form with default value for anctype.[/color]

    That's because the default _is_ "applicatio n/x-www-form-urlencoded".

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

    Comment

    • opt_inf_env@yahoo.com

      #3
      Re: Form and enctype.

      The main question is what can happen if I use text fields in
      combination with enctype="multip art/form-data".

      Comment

      • Jukka K. Korpela

        #4
        Re: Form and enctype.

        opt_inf_env@yah oo.com wrote:
        [color=blue]
        > The main question is what can happen if I use text fields in
        > combination with enctype="multip art/form-data".[/color]

        Well, that's _not_ what you asked first time. Yet, it too _was_ answered in
        my message.

        Consider reading what I wrote. If problems remain, please quote the part you
        didn't understand and try to explain why you find it difficult.

        --
        Yucca, http://www.cs.tut.fi/~jkorpela/
        Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

        Comment

        • opt_inf_env@yahoo.com

          #5
          Re: Form and enctype.

          > > The main question is what can happen if I use text fields in[color=blue][color=green]
          > > combination with enctype="multip art/form-data".[/color]
          >
          > Well, that's _not_ what you asked first time. Yet, it too _was_ answered in
          > my message.[/color]

          Your answer should be here.[color=blue][color=green]
          > > In other cases one needs to use:
          > > enctype="applic ation/x-www-form-urlencoded"[/color]
          > No, you don't. First, it's the default, so it need not be specified
          > explicitly. Second, enctype="multip art/form-data" can be used even if there
          > is no file input field. It's just about the format of encoding form data.[/color]
          However, it is not full answer. I know that value of enctype change
          format of encoding. The question is what exectly these changes are? How
          I can see these changes. I posted values of text fields with the usage
          of both values of enctype and I did not find any differences.

          Comment

          • David Dorward

            #6
            Re: Form and enctype.

            opt_inf_env@yah oo.com wrote:
            [color=blue][color=green]
            >> Well, that's _not_ what you asked first time. Yet, it too _was_ answered
            >> in my message.[/color][/color]
            [color=blue]
            > Your answer should be here.[/color]

            If you don't like being refered back to a previous answer instead of having
            redundant copy/pasting dumped into the thread, then I'm sure that Jukka
            would be quite happy to provide you will a full refund of everything you've
            paid him for his help on this matter.
            [color=blue]
            > However, it is not full answer. I know that value of enctype change
            > format of encoding. The question is what exectly these changes are? How
            > I can see these changes.[/color]

            If you really care then you can look at the differences in STDIN and
            environment variables received by your server side script ... but since
            pretty much every form handling library deals with such things
            transparently, it doesn't really make much practical difference[1].
            [color=blue]
            > I posted values of text fields with the usage
            > of both values of enctype and I did not find any differences.[/color]

            Presumably because your form handling library handles it transparently (as
            is only sensible), so it makes no practical difference to you.



            [1] Unless you are writing your own such library, but I wouldn't recommend
            attempting that if you aren't skilled enough to find the specification that
            you want to implement.

            --
            David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
            Home is where the ~/.bashrc is

            Comment

            • opt_inf_env@yahoo.com

              #7
              Re: Form and enctype.

              Thank you for your answer.

              P.S. Sometimes it is easier to get answer in newsgroups than to read
              hundreds of pages overfilled by a formalized syntax. One person spends
              30 second to help me avoid hours of usefulness search and reading. It
              is for what forums are, isn't. Moreover, one needs to remember that
              nobody is forced to give me answer.

              Comment

              • David Dorward

                #8
                Re: Form and enctype.

                opt_inf_env@yah oo.com wrote:
                [color=blue]
                > P.S. Sometimes it is easier to get answer in newsgroups than to read
                > hundreds of pages overfilled by a formalized syntax.[/color]

                Umm. "The post you just responded to" was not "hundreds of pages overfilled
                by a formalized syntax". The closest anybody came to suggesting you read
                something like that was my comment that you would need to if you were
                implementing a form processing library ... which doesn't seem likely given
                your earlier remarks.
                [color=blue]
                > Moreover, one needs to remember that nobody is forced to give me answer.[/color]

                All the more reason for you to be polite.... which includes following the
                Usenet convention of quoting sufficient material from the post you are
                responding to to make clear the context of your message.

                --
                David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
                Home is where the ~/.bashrc is

                Comment

                • Charlie King

                  #9
                  Re: Form and enctype.

                  On Sun, 15 Jan 2006 12:06:15 +0000, in
                  <dqdduc$o4n$1$8 302bc10@news.de mon.co.uk>
                  (comp.infosyste ms.www.authoring.html) David Dorward
                  <dorward@yahoo. com> wrote:
                  [color=blue]
                  > All the more reason for you to be polite....[/color]

                  One's reasons to be polite are substantially eroded once one's
                  correspondent takes it upon himself to be condescendingly rude and
                  patronising to one, don't you think?
                  --
                  Charlie

                  Comment

                  • Michael Winter

                    #10
                    [OT] Behaviour (was: Re: Form and enctype.)

                    On 15/01/2006 15:41, Charlie King wrote:

                    [snip]
                    [color=blue]
                    > One's reasons to be polite are substantially eroded once one's
                    > correspondent takes it upon himself to be condescendingly rude and
                    > patronising to one, don't you think?[/color]

                    No, not particularly. The "They started it!" defence is something one
                    should expect from children, not adults.

                    If one were so offended, one should either refrain from posting, or
                    kill-file the offending person. It would, of course, be nice to never
                    experience discourtesy, but such a thing will be forever present
                    (especially in Usenet).

                    Mike

                    --
                    Michael Winter
                    Prefix subject with [News] before replying by e-mail.

                    Comment

                    Working...