php 上传图片文件 重赏 急 谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/27 04:53:29
用的是mysql,数据库应该没有问题,何况上传文件到本地的一个文件夹跟数据库也没关系。
谢谢哪位高手帮忙看一下,主要是上传那几句。
如果写例如: $photo=$_FILES['photo'];的话 浏览器会不认
我用的php版是 4.3.10 IE7
错误显示:Notice: Undefined index: photo in c:\program files\easyphp1-8\www\exercices\e6\61.php on line 44
<html>
<head>
<title>61</title>
<style>body {margin-right:40%}</style>
</head>

<body>

<?php
if(!isset($_POST['name'])&& !isset($_POST['address'])&& !isset($_POST['gender']))
{
?>
<h1>Registration</h1>
<form enctype="multipart/form-data " method="post" action="61.php">
<fieldset>
<legend>Your information</legend>
<ul>
<li>Your name:<input type="text" name="name"></li>
<li>Your addres

你的程序逻辑上有问题,导致实现不到应有的效果,我根据你的程序改了一下,写进数据库的那部分你自己加上去就OK,代码如下:

<html>
<head>
<title>61</title>
<style>body {margin-right:40%}</style>
</head>

<body>

<?php

if($_GET['action'] == 'upfile')
{
$name=$_POST['name'];
$address=$_POST['address'];
$gender=$_POST['gender'];
$note=$_POST['note'];
$target_path = 'upload/'.$_FILES['photo']['name'];

copy($_FILES['photo']['tmp_name'], $target_path);

echo "Your register Data as follow:<br>{$name}<br> {$address}<br> {$gender}<br> {$note}<br><br>Upload result:";

if(file_exists($target_path)) {
echo '<font color="green">Succeed!</font>';
} else {
echo '<font color="r