Re: Form Input Type="File"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2008-11-22 at 09:54 -0600, Shawn McKenzie wrote:
> Stan wrote:
> > Ashley,
> > If you go back to the original append you will see the URLs.  IE 6 SP1
> > returns exactly the string that appears in the <input name=\"SELECTEDFILE\"
> > type=\"file\" /> text box, FireFox does not.  I would assume that anyone
> > using the dialog would expect the behaviour that IE demonstrates.
> > 
> > www.w3.org doesn't say anything about the return value.
> > 
> > These are the only 2 browsers that I have available.
> > 
> > What I need to know is: Which is behaving as all browsers will behave going
> > forward?
> > 
> > 
> 
> If I remember correctly, when you POST a form the values are urlencoded
> automagically.  But your form method is GET so you should probably
> urlencode the values, especially the ones with non-alphanumeric
> characters like {, }, etc...
> 
> -- 
> Thanks!
> -Shawn
> http://www.spidean.com
> 
It's obvious that you can't rely on the value from the upload element. I
suspect the Mozilla behaviour is a security thing.

I didn't realise until Shawn just mentioned it, but why are you using
GET for your form when it contains an file input box? It should really
be POST and your enctype should be "multipart/form-data", as you won't
get any files uploaded from this. When you have got the file uploaded,
you can use the $_FILES array to get the real filename of the file, and
then construct all your paths out of that.

Also, if the W3C mentions nothing about how this should be implemented,
then you cannot rely on any particular method. If you're still
determined to use file inputs with the current form attributes as they
are, why not use the basename() function to extract the filename from
the path, then whichever browser you use you'll have the same value to
play with.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux