dongzhuohan7085 2019-04-21 16:27
浏览 30
已采纳

使用move_uploaded_file的Php问题。 似乎一切都很好,但它不起作用

I am trying to use move_uploaded_file but I think everything is fine but my code is not working. Everything is working as expected even image name is being inserted into DB but it is not moving into uploads folder. Folder is there and apache2 does have access to write it.

I don't have enough reputation to post more then 8 lines so everything is on pastebin Here. The main aprt is...

 $post_image_new_name = uniqid('', true). "." 
.$post_image_actual_ext;

                $post_image_destination = '../../uploads/';
                    if (is_dir($post_image_destination) && is_writable($post_image_destination)) {

                    $post_image_destination = '../../uploads/'.$post_image_new_name;
                    var_dump($post_image_destination);
                    move_uploaded_file($post_image_new_name, $post_image_destination);
                    echo "Inside move_uploaded_file section";

https://pastebin.com/Z321R76z

  • 写回答

2条回答 默认 最新

  • douyao2529 2019-04-21 19:27
    关注

    Try this code line 53: move_uploaded_file($_FILES['addPost_post_image']['tmp_name'], $post_image_destination);

    The first param should be the file source name.

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

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?