douyunjiaok300404 2013-08-28 00:07
浏览 52

我想在“迷你ajax文件上传表单”脚本中添加下载链接生成器

i'm trying to get a download link after a file is uploaded using "mini AJAX file upload form" mini-ajax-file-upload-form

i am trying to get this script to work with it but all the scipt does is upload it but i get no download link response.

if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br>";
  }
else
  {
    $r = rand(1,100000);
    $filename = $r . $_FILES["file"]["name"];
  if (file_exists("upload/" . $filename)) {
    echo "<center>";
      echo $_FILES["file"]["name"] . " already exists. Please Rename your file and try again.</center><br>";
      }
  else
  {
  $link="$baseurl/upload/" . $filename;
  move_uploaded_file($_FILES["file"]["tmp_name"],
  "upload/" . $filename);
  echo "<center>Direct Download link: <a href=\"$link\">$link</a></center><br>";

can someone take a look at "mini AJAX file upload form" for me?

THANX!

  • 写回答

1条回答 默认 最新

  • doudichu1358 2013-08-28 03:07
    关注

    Are you sure that the 'upload' directory has write permissions??

    Next time, you can try to add these lines at the top of your code

    ini_set('display_errors',1);
    error_reporting(E_ALL);
    

    If move_uploaded_file failed, it will always print out an error with detailed explanation.

    评论

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来