MG <po**@mpc1000.com> wrote:
http://www.cs.tut.fi/~jkorpela/forms/file.html
"A common problem with file input in forms is that form data gets sent
but only the name of the file is included. The reason is typically that
the form element does not contain the attributes mentioned above."
I think I am reading this to say that an incomplete form may not send
the file. There are several items "mentioned above".
The attributes I'm referring to are 'action', 'method', and 'enctype',
which are essential for making file submission work. But the most important
in this context is 'enctype'.
My statement discusses known behavior for _erroneous_ forms that contain a
file input field without having the attributes of the <form> element set
properly. So I would not count on building anything on the assumption that
something specific happens when you throw a malformed form at a browser.
At
http://www.cs.tut.fi/~jkorpela/forms/file.html#name
I discuss the way browsers deal with the filename, which thet _may_ (and
mostly do, in practice) include into the form data headers. You would meet
the problem that most browsers include a pathname, which is generally
unusable outside the context of the user's system. Thus, you would need to
do some string manipulation to extract the assumed filename proper,
probably picking up the maximal trailing alphanumeric string, counting a
period as alphanumeric in this context.
There's no defined way to have such information included without having the
file content included as well. When some browsers behave that way, it's
nothing more than (questionable) error processing. In the WWW context,
which is implied in this group, it would hardly make any sense to deal with
pure filenames, even if you could in some sense get at them.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring:
http://www.cs.tut.fi/~jkorpela/www.html