我无法使用php上传文件,因为我无法将从html文件中获取的路径发送到 函数FTP_PUT,因为它只接受字符串“test.txt” p>
如何将路径发送到此函数 p>
PHP文件 p>
$ file = $ _POST [“file”];
//上传文件
if(ftp_put($ ftp_conn,$ file,$ file,FTP_BINARY))
{\ n echo“已成功上传$ file。”;
}
else
{
echo“上传$ file时出错。”;
}
//关闭连接
ftp_close($ ftp_conn);
< / code> pre>
HTML FILE p>
p>
&lt; div class =“container”&gt ;
&lt; div class =“row”&gt;
&lt; div class =“col-lg-12”&gt;
&lt; form class =“well”action =“Upload.php”method = “post”&gt;
&lt; div class =“form-group”&gt;
&lt; label for =“file”&gt;选择要上传的文件&lt; / label&gt;
&lt; input type =“file”name =“file”id =“file”&gt;
&lt;! - &lt; p class =“help-block”&gt;只有jpg,jpeg,png和gif文件 最大大小为1 MB是允许的。&lt; / p&gt; - &gt;
&lt; / div&gt;
&lt; input type =“submit”class =“btn btn-lg btn-primary”value =“Upload”&gt;
&lt; / form&gt;
&lt; / DIV&GT;
&LT; / DIV&GT;
&LT; / DIV&GT;
code> pre>
div>