Re: uploading php file.

Hi Bob,

I'm coIpying my answer to the www-validator mailing-list, I hope you  
do not mind. I try to document problem solving as much as possible,  
so that it can benefit others later.

On Jul 26, 2006, at 08:48 , R.Beeman wrote:

> Hello Olivier:
> If what is being validated is a page on a web site, validation  
> proceeds correctly and, at least for this file, the result is  
> "passed validation".
>
> If what is being validated is an uploaded file with a .php  
> extension , it fails validation, but if the extension is changed  
> to .htm or .html it passes.

Hmm, this sounds like a problem which does not actually come from the  
validator, let me explain a little more:

the validator can not validate every and anything. For instance, you  
can not validate a jpeg image. In order to find out what documents it  
can or cannot handle, the validator relies on "content type"  
information sent by your server (when validating by URI) or by the  
browser (when validating by upload).

In the case you are experiencing, your operating system (and your  
browser) sends the .php files with a content-type information that  
the validator considers "outside of the range of file types it can  
handle". That's perhaps not surprising: files with .php extensions  
are usually php files, which have to be interpreted by a web server  
to create an HTML document. That's why the .php files are not  
necessarily labeled by your system as being html content.

I would therefore recommend, whenever possible, that you validate php  
documents online, rather that via upload; and if you want to use  
upload validation for documents created by php scripts, they're  
better saved as .html files.


I hope this is a helpful clarification.

cheers,
-- 
olivier

Received on Wednesday, 26 July 2006 04:41:30 UTC