2015-11-14 102 views
0

這裏是我的HTML:POST方法不採取文件輸入

<!DOCTYPE html> 
<html> 
<head> 
    <title>This is where we add Party.</title> 
</head> 
<body> 
<form action="viewParties.php" method="post" enctype="multipart/form-data"> 

PartyList:<br> 
<input type="text" name="partylist"><br> 
<input type="file" name="pafile"><br><br> 

President:<br> 
<input type="text" name="president"><br> 
<input type="file" name="pfile"><br><br> 

Vice President:<br> 
<input type="text" name="vicepresident"><br> 
<input type="file" name="vpfile"><br><br> 

Secretary:<br> 
<input type="text" name="secretary"><br> 
<input type="file" name="secpfile"><br><br> 

<input type="submit" name="submit"><br><br> 

</form> 
</body> 
</html> 

基本上我希望發生的是POST方法取這兩個名字和文件位置。但是當我在另一個PHP文件中使用print_r($ _ POST)時,它只顯示名稱。有人知道如何解決這個問題嗎?

+1

use print_r($ _ FILES);打印文件的值 –

+0

這樣寫'enctype =「multipart/form-data」' –

+0

mhmm。 =)有點晚了,但是感謝tho = D –

回答

2

找到它。結果我需要,不僅要打印($ _ POST)來查看我提交的內容,還要查看print_r($ _ FILES)以查看我提交的文件。我做了一些修補,這就是我發現的。希望這可以幫助別人。 =)