Gizem, değişken yol adı

1 Cevap php

Bu çalışır:

    function upload($directory) {
      App::import('Vendor', 'UploadedFiles', array('file' => 'UploadedFiles.php'));

      echo $directory;
      $this->_saveUploadedFiles('C:/xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042/');
    }

  function _saveUploadedFiles($galleryPath) {

    $absGalleryPath = $galleryPath;
    $absThumbnailsPath = 'C:\xampp\htdocs\freetickets\app\webroot\img\gallery\zantje_11042\thumbnails\\';

    //Iterate through uploaded data and save the original file, thumbnail, and description.
    while(($file = UploadedFiles::fetchNext()) !== null) {
      $fileName = $file->getSourceFile()->getSafeFileName($absGalleryPath);
      $file->getSourceFile()->save($absGalleryPath . '/' . $fileName);

      $thumbFileName = $file->getThumbnail(1)->getSafeFileName($absThumbnailsPath);
      $file->getThumbnail(1)->save($absThumbnailsPath . '/' . $thumbFileName);
    }
  }

Ama bu değil:

        function upload($directory) {
      App::import('Vendor', 'UploadedFiles', array('file' => 'UploadedFiles.php'));

      echo $directory; //echoes C:/xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042/
      $this->_saveUploadedFiles($directory);
    }

  function _saveUploadedFiles($galleryPath) {

    $absGalleryPath = $galleryPath;
    $absThumbnailsPath = 'C:\xampp\htdocs\freetickets\app\webroot\img\gallery\zantje_11042\thumbnails\\';

    //Iterate through uploaded data and save the original file, thumbnail, and description.
    while(($file = UploadedFiles::fetchNext()) !== null) {
      $fileName = $file->getSourceFile()->getSafeFileName($absGalleryPath);
      $file->getSourceFile()->save($absGalleryPath . '/' . $fileName);

      $thumbFileName = $file->getThumbnail(1)->getSafeFileName($absThumbnailsPath);
      $file->getThumbnail(1)->save($absThumbnailsPath . '/' . $thumbFileName);
    }
  }

Only difference $ this-> _saveUploadedFiles ('C :/ xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042 /') ve yolu gibi bir değişken ile biridir: $ this-> _saveUploadedFiles ($ dizin);

$ Dizini kullanarak neden o zaman $ dizini C :/ xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042 / yankıları bile çalışmıyor?

Teşekkürler

1 Cevap

Yolları klasör ayırıcı olarak size koyduk yol / ve \ edin.