在php上传文件 [英] Uploading a file in php

查看:56
本文介绍了在php上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在处理一个PHP代码,用于使用Web表单上传文件实际上是一个图像。但成功上传图片后,我收到一条错误消息,说明

'注意:未定义的索引:上传到C:\ xampp \\\\\\\\\\\\\\\\\\\\\\第13行

文件已上传,您的信息已添加到目录中




我不知道我的addok.php文件中有什么问题。但是源代码将插入到这篇文章的底部!



Hi I have working on a php code that used to upload a file actually an image using a web form. But after successfully upload the image I have got an error message saying that
'Notice: Undefined index: uploaded in C:\xampp\htdocs\test\addok.php on line 13
The file has been uploaded, and your information has been added to the directory


I don't know what is the problem in my addok.php file. However the source code will be inserted at the bottom of this post!

 <?php

$target = "images/";
$target = $target.basename($_FILES['photo']['name']);

//$name=$_POST['name'];
//$email=$_POST['email'];
//$phone=$_POST['phone'];
//$pic=($_FILES['photo']['name']);

if(move_uploaded_file($_FILES['photo']['tmp_name'],$target))
   {
       echo "The file ".basename($_FILES['uploaded']['name'])." has been uploaded, and your information has been added to the directory";
   }
   else {
       echo "Sorry, there was a problem uploading your file.";
   }

?>





如果你们有时间,请尝试解决我的问题。

Thanx。



Chiranthaka



If you guys have some time, please try to solve my problem.
Thanx.

Chiranthaka

推荐答案

target = images /;
target = "images/";


target =
target =


target.basename(
target.basename(


这篇关于在php上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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