上传在localhost上工作的图像,但在服务器上不工作

时间:2019-01-31 18:00:44

标签: php mysql image upload

此代码用于上传图像,它在localhost上运行,但是当我将其上传到服务器时,它将图像放置在php文件之间。请问怎么了

Dim c as range, f
'loop over selected cells
for each c in selection.cells
    f = c.formula
    f = Replace(f, "-Sept", "-Dec")
    f = Replace(f, "3Q2018", "4Q2018")        
    '...replace ranges
    c.formula = f
next c

2 个答案:

答案 0 :(得分:2)

尝试用以下内容替换您拥有的东西:

  move_uploaded_file($ImgTmp, 'upload/img/'.$img);
  move_uploaded_file($ImgTmp1, 'upload/img/'.$img);
  move_uploaded_file($ImgTmp2, 'upload/img/'.$img);
  move_uploaded_file($ImgTmp3, 'upload/img/'.$img);
  move_uploaded_file($ImgTmp4, 'upload/img/'.$img);

确保您的上传目录可用。

编码愉快!

答案 1 :(得分:0)

谢谢,我使用此解决方案对其进行了修复

      $my = rand(0, 66666666);
      $my .= $ImgName;
      $my1 = rand(0, 7777777);
      $my1 .= $ImgName1;
      $my2 = rand(0, 8888888);
      $my2 .= $ImgName2;
      $my3 = rand(0, 99999999);
      $my3 .= $ImgName3;
      $my4 = rand(0, 25874963);
      $my4 .= $ImgName4;

       $target = "upload/img/".basename($my);
       $target1 = "upload/img/".basename($my1);
       $target2 = "upload/img/".basename($my2);
       $target3 = "upload/img/".basename($my3);
       $target4 = "upload/img/".basename($my4);

      move_uploaded_file($ImgTmp,  $target);
      move_uploaded_file($ImgTmp1, $target1);
      move_uploaded_file($ImgTmp2, $target2);
      move_uploaded_file($ImgTmp3, $target3);
      move_uploaded_file($ImgTmp4, $target4);