Questions tagged [symfony-filesystem]

The Symfony filesystem component provides basic utilities for the filesystem.

The Filesystem component was introduced in Symfony 2.1. Previously, the Filesystem class was located in the HttpKernel component. More details can be found here.

8 questions
7
votes
5 answers

Why I can't get Symfony Finder like a service?

I use Symfony Standard Edition and try to get Symfony Finder component like a service, but not found it. To use the Finder, I need to create it manually like: $finder = new Symfony\Component\Finder\Finder(); Why I can't get it from service…
2
votes
1 answer

Symfony not create file by touch( )

I want to creat file this path : /var/logs/filename.fileextension . But ı dont create file ı have error ->Failed to touch "/var/logs/file.txt". My Codes: $fs=new Filesystem(); $fs->touch('/var/logs/file.txt');
Burhan Yılmaz
  • 774
  • 8
  • 21
2
votes
2 answers

Touch a file as sudo

How can I touch a file as sudo when using [Symfony's Filesystem][1]? So far I have: $fs = new Filesystem(); $confFile = sprintf('/etc/apache2/sites-available/%s.conf', $input->getArgument('name')); $fs->touch($confFile); But this code fails with…
mikelovelyuk
  • 4,042
  • 9
  • 49
  • 95
1
vote
1 answer

Phar archive no read and write permissions with symfony filesystem

i have created a cli app which tries to create a file with symfony 3 fileSystem component. All works fine, but if i put the app in a phar archive symfony can't write the file. This is how i created the phar archive:
freesh
  • 199
  • 2
  • 11
0
votes
1 answer

PHP Change default User on fopen

I'm having problems when trying to write a file with a different user rather than www-data. I need to leave the file on a mapped unit that it's NOT mine so i cannot change permissions on that one. Insetead i have a username and a group, let's call…
SpicyTacos23
  • 500
  • 5
  • 16
0
votes
1 answer

Symfony 4 : How to delete a file from folder using remove function of the filesystem component

I am trying to remove a file from folder using remove function of the filesystem component in Symfony 4. Here is my code in the controller: //Get old logo $oldlogo = $employer->getLogo(); //If there is a old logo we need to detele it …
Alex G
  • 31
  • 1
  • 10
0
votes
1 answer

Symfony access handling for specific folders dependend on logged in user

In a symfony 5.0 application I need to integrate a filemanager that provides basic file handling for users. Each user is only allowed to manage files in his specific user folder which (obviously) is not in the public folder but at some path…
-2
votes
1 answer

Symfony Filesystem chmod() sets the incorrect permissions

I am using the Symfony's Filesystem component, specifically chmod function: $this->filesystem->copy($file_path, $target_file, TRUE); $this->filesystem->chmod($target_file, '0777'); But on the terminal the permissions are weird: $ ls -la…
rpayanm
  • 6,303
  • 7
  • 26
  • 39