I am trying to populate an array with a path to a file.
<?php
session_start(session_id());
$galleryID = $_SESSION['newGalleryId'];
$path_pages = '../../../../data/gallery/' . $galleryID . '/images/album/';
?>
<?php
class UploadHandler
{
protected $options;
function __construct($options=null) {
$this->options = array(
'script_url' => $this->getFullUrl().'/',
'upload_dir' => $path_pages,
'upload_url' => $path_pages,
'param_name' => 'files'
}
?>
I am using the jQuery-file-upload to upload files to a directory. If I hard code the $galleryID in it works fine, but when I try to plug in the $variable it doesn’t work. Any ideas why the $galleryID is causing me issues.
Thanks
Try:
Sounds like the $_SESSION is not starting. Adding session_start will instantiate the session and hopefully pull your variable.
Update
You should set your options like so:
Your $path_pages does not have any visibility into the UploadHelper class. Since the class can handle options in the constructor, pass the options when instantiating the class.