简体   繁体   中英

require_once function breaks upload form

I discovered that my upload form seems to work in all common browsers, including Firefox, Chrome and IE8.

But when it comes to IE9 it fails.

Btw, the form is in a PHP file.

This is what the file looked like:

<? 
require_once ($_SERVER["DOCUMENT_ROOT"].'/_meta/phpFunctionsLibrary.php');
echo '--- HTML Code including the form element ---'
?>

Then I deleted the "require_once" line, and suddenly it worked in IE9 also.

Fortunately, in this case the Library is dispensable to a certain extent, but of course I can't rely on that.

So I need to know what could have caused this mess in IE9...

来自类似的PHP / HTML / CSS的 stackoverflow文章:使用require_once()时IE表现得很奇怪 -关闭后库文件的末尾可能会有空格?> ...尝试删除该空格或摆脱掉结尾'? >'标签,它是可选的。

The PHP is rendered on the server, so the same document is being sent regardless of the browser. I would check to see if any php is accidently being output or echoed, maybe messing up the HTML causing it to be handled incorrectly in IE

Okay, I've got the solution: The PHP file containing the form is UTF-8 encoded, and the included "phpFunctionsLibrary.php" was UTF-8 encoded, too. I changed only the latter one to ANSI, then it worked in IE9.

To me, this is weird, but perhaps somebody has an explanation for this. As long as the included file was UTF-8 IE9 - and only IE9 - refused to exexute the upload, even when I deleted everything in the included file, making it empty .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM