我想上传文件到我的php服务器,然后返回文件的名称以显示在html文档中。但我得到以下上传文件到服务器并返回文件名称
`error: Objektet wasn't found! The requested address was not found on this server. The link on the previous page appears to be incorrect or out of date Error 404
localhost
Apache/2.4.27 (Win32) OpenSSL/1.0.2l PHP/7.1.8`
我的HTML文档
<html>
<body>
<form method="post" enctype="multipart/form-data" action="server.php">
<input type="file" name="fileToUpload" id="fileToUpload" size="35">
<br>
<br>
<input type="submit" value="Upload" name="submit">
</body>
</html>
我的PHP文档
<?php
header('Content-type: text/plain');
if(isset($_POST["fileToUpload"])){
$file = $_FILES["fileToUpload"];
echo("File: ".$file);
}
?>
对不起,我要更新答案,我只是改了名字。仍然不能解决我的问题 – Amar
@ Amar.please复制粘贴我的代码.i已经测试它可以正常工作 – iCoders
对,它的工作原理。对不起,我的无知。我会尽快将你的答案作为解决方案 – Amar