用于将文件上载到服务器的Html和PHP代码 [英] Html and PHP code to upload a file to a server

查看:67
本文介绍了用于将文件上载到服务器的Html和PHP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你可以帮我解决一下代码,不知道问题是什么,它上传文件但在网页浏览器上发出错误信息,尝试所有的浏览器,仍然是同样的问题,

index.html代码

Can you please help me with the code not sure what the problem is, it upload the file but gives a error message on the web browser, try all of the browsers and still the same problem,
index.html code

<form action="upload.php" method="post" enctype="multipart/form-data"> 
 <input type="file" name="myFile">
 <br>
 <input type="submit" value="Upload">
</form>





upload.php代码

define(/ var / www / upload /);



if(!empty($ _ FILES [ myFile])){

$ myFile = $ _FILES [myFile];



if($ myFile [error] !== UPLOAD_ERR_OK){

echo

发生错误。



upload.php code
define("/var/www/upload/");

if (!empty($_FILES["myFile"])) {
$myFile = $_FILES["myFile"];

if ($myFile["error"] !== UPLOAD_ERR_OK) {
echo "

An error occurred.

无法保存文件。

Warning: define() expects at least 2 parameters, 1 given in C:\wamp\www\upload.php on line 2


Call Stack


#

Time

Memory

Function

Location

1 0.0000 133992 {main}( ) ..\upload.php:0 
2 0.0000 134088 define ( ) ..\upload.php:2 





我的尝试:



检查服务器和代码的基础,



What I have tried:

check the premision on the server and the code,

推荐答案

_FILES [myFile ])){
_FILES["myFile"])) {


myFile =


_FILES [myFile];



if(
_FILES["myFile"];

if (


这篇关于用于将文件上载到服务器的Html和PHP代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆