I'm building rest api to write to json file but I get

This path not writable

here is the code

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $ioFile = $objectManager->create('\Magento\Framework\Filesystem');
    $dirPath = $ioFile->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::APP);

what is the problem?. If it's a permission problem can you explain the problem

  • does the path to the file exist? – Philipp Sander Feb 19 at 10:33
  • writeing to the app folder is a bad partice... use var or tmp – Philipp Sander Feb 19 at 10:34
  • @PhilippSander yes, it exists. And why this is bad practice? – Yomna Mansour Feb 19 at 10:36
  • app is dedicated for code and design files. file in app are checked in your VCS. what's the benefit of having it in app instead of var? – Philipp Sander Feb 19 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.