drpfu51608120170 2012-06-20 12:19
浏览 11
已采纳

无法上传我的文件

I have this Form I am trying to upload my image but every time I do "update" the page return normal and nothing uploded to my folder "ProfilesImages" where is my fault.

<?php
if(isset($_POST['update'])){
    $ProfileImage = $_FILES['ProfileImage']['name'];
    $Fname = clean_text($_POST['Fname']);
    $Lname = clean_text($_POST['Lname']);
    $Uemail = $_POST['Remail'];
    $Uwebsite = $_POST['website'];
    $Ugender = clean_text($_POST['select']);
    $Ubirth = (int)$_POST['birth'];
    $UWork = clean_text($_POST['company']);
    $Uabout = clean_text($_POST['aboutMe']);
    $Uhobby = clean_text($_POST['hobby']);
    $Uprivatie = $_POST['radio'];
    $target = "includes/ProfilesImages/";
    $target = $target . basename ($_FILES['ProfileImage']['name']);
    $updateUserData = "UPDATE loginaccess SET
        profile_image='".$ProfileImage."',
        FUname = '".$Fname."',
        LUname = '".$Lname."',
        Email = '".$Uemail."',
        Website = '".$Uwebsite."',
        gender = '".$Ugender."',
        birth = '".$Ubirth."',
        work = '".$UWork."',
        about = '".$Uabout."',
        hobby = '".$Uhobby."',
        privatie = '".$Uprivatie."' where Email='".$_SESSION['email']."' AND active=1";
    if(move_uploaded_file($_FILES['ProfileImage']['tmp_name'], $target))
    {
            echo "<p>The image you have attached was uploaded successfully</p>";
    }
    else
    {
            echo " <p><strong>Notes</strong> : no image was attached to the registration form..! </p>";
    }
    $updateUserDataResults= $db->query($updateUserData) or die("$db->error");
    if($updateUserDataResults){
            header("Location:index.php?cat=user&learn_id=1");
    }
}
?>

any help plz...

  • 写回答

2条回答 默认 最新

  • duanjiao8871 2012-06-20 12:23
    关注

    be sure to set the fileupload enctype in your form

    <form action="index.php" method="post" enctype="multipart/form-data">
    

    otherwise the file won't be uploaded

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看