知道如何上传文件 [英] to know how to upload file
本文介绍了知道如何上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以php格式上传文件或图像
how to upload file or images in php form
推荐答案
下次尝试 [ ^ ]
基本上你必须创建一个< form>并且必须有multipart / form-data才能上传文件。
类似于:
Basically you have to create a <form> and there must be multipart/form-data to upload a file.
Something like:
<html>
<body>
<form action="upload_file.php" method="post">
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</input></br></input></form>
</body>
</html>
和PHP文件中的类似:
And in the PHP file something like that:
if (
_FILES [ file] [< span class =code-string> error]> 0)
{
echo 错误:。
_FILES["file"]["error"] > 0) { echo "Error: " .
这篇关于知道如何上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文