Note that there are some explanatory texts on larger screens.

plurals
  1. POMystery, variable path name
    primarykey
    data
    text
    <p>This works:</p> <pre><code> function upload($directory) { App::import('Vendor', 'UploadedFiles', array('file' =&gt; 'UploadedFiles.php')); echo $directory; $this-&gt;_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-&gt;getSourceFile()-&gt;getSafeFileName($absGalleryPath); $file-&gt;getSourceFile()-&gt;save($absGalleryPath . '/' . $fileName); $thumbFileName = $file-&gt;getThumbnail(1)-&gt;getSafeFileName($absThumbnailsPath); $file-&gt;getThumbnail(1)-&gt;save($absThumbnailsPath . '/' . $thumbFileName); } } </code></pre> <p>But this doesn't:</p> <pre><code> function upload($directory) { App::import('Vendor', 'UploadedFiles', array('file' =&gt; 'UploadedFiles.php')); echo $directory; //echoes C:/xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042/ $this-&gt;_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-&gt;getSourceFile()-&gt;getSafeFileName($absGalleryPath); $file-&gt;getSourceFile()-&gt;save($absGalleryPath . '/' . $fileName); $thumbFileName = $file-&gt;getThumbnail(1)-&gt;getSafeFileName($absThumbnailsPath); $file-&gt;getThumbnail(1)-&gt;save($absThumbnailsPath . '/' . $thumbFileName); } } </code></pre> <p><strong>Only difference</strong> is the <code>$this-&gt;_saveUploadedFiles('C:/xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042/')</code> and one with a variable as path: <code>$this-&gt;_saveUploadedFiles($directory);</code> </p> <p>So why doesn't it work when using $directory, even if <code>$directory</code> echoes C:/xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042/ ?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload