When an instance is created, it is created with a file storage, which can be accessed through the File class.
A file can be added to the store like:
$file = new File(); $file->folder = 'Myfolder'; $file->attachFile('/tmp/realfile.txt'); $file->save(); echo 'File saved with ID: '.$file->file_id;
To get access to the file data afterwards:
$file = new File(); $file->loadForRead($file_id); // Get a psychical path $file->getCompleteFilename(); // Get an URL $file->getURL();
The file is actually saved in the given folder within the storage, so the folder should be a valid folder name. The folder name can be nested such as folder/subfolder/subsubfolder/
.