2010-09-13 86 views
3

我嘗試在一個隱藏的輸入後base64編碼的圖像(〜500KB)和我得到的是一個錯誤發佈base64編碼文件的問題

501 Method Not Implemented 

GET to /test.php not supported. 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 

我的代碼

<?php error_reporting(E_ALL) ?> 
<html> 
<head></head> 
<body> 
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST"> 
<input type="hidden" name="image" value="{base64 encoded image}"> 
<input type="submit" name="" value="OK"> 
</form> 

<?php if($_POST) { 
    echo '<pre>'.print_r($_POST, true).'</pre>'; 
} ?> 

</body> 
</html> 

PS。在本地主機上一切正常。

感謝您的幫助。

+0

它是圖像的錯嗎? – oneat 2010-09-13 16:26:55

+0

不支持GET/test.php嗎?但是你說你正在做'POST'? – 2010-09-13 16:29:31

+0

@oneat No.我只是測試,所以我的代碼只是形式和print_r($ _ POST); – kat 2010-09-13 16:31:48

回答

0

這可能是由於安全問題。試試這個:

爲了解決這個問題,將它添加到您的/etc/httpd/conf/httpd.conf中,與(Apache目錄樹的根的路徑)開始的塊中:

SecRuleEngine off 

<Directory "/var/www/html"> 
    SecRuleEngine off 
</Directory> 

/var/www/html是您網站的DOCUMENT_ROOT。重新啓動/重新加載Apache。

0

假設你使用相同的瀏覽器,它可能是post_max_size php.ini設置,雖然我認爲默認情況下它會設置得比〜500KB高得多。

+0

ini_get('post_max_size')返回64M – kat 2010-09-13 16:40:39

0

看看錯誤消息,有兩個問題。一個是501,一個是404。

501是因爲你的web服務器不能識別POST方法。嘗試使用小寫文章(儘管如果導致錯誤,我會感到驚訝)。

404是因爲沒有找到窗體的目標(或者它可能被錯誤配置),並且沒有設置ErrorDocument來處理404's。在瀏覽器中查看錶單的html,並確保$_SERVER['PHP_SELF']正在輸出正確的URI。

如果這些都不奇怪,請嘗試發佈沒有任何圖像數據的表單。這可能是因爲您需要對POST傳輸的數據進行編碼。