shell - Zipping files through shell_exec in PHP: problem with paths -


I am working on the part of a web backup service whereby the user downloads a zip file containing those files

The zipping process is done through shell_exec command, which is supported by whatever they have chosen, to work. To work, I used the zip command to send the Apache user to non- The password has been provided by Adobe Edwards.

My problem is because I can not do "sudo cd / path / to / user / files" to specify the full path path for the files to zip me into a folder with user's backup files Required, which then goes to the zip file which I do not want.

What do I mean here:

Users have a backup of their files of 'test1', which are stored as follows /
/ backup / test1 / my pics / pic1.jpg

/ home / backup / test1 / my pics / Pic2.jpg

Home / Backup / Test 1 / My Picture / pic3.jpg

Home / Backup / Test 1 / Heilo. Txt
/home/backups/test1/music/band/song.mp3

When these files are zipped, they keep the full path, but I want to show it:
My Pictures / pic1.jpg
My Pictures / pic2.jpg
My Pictures / pic2.jpg
My Pictures / pic2 .jpg
hello.txt
music / band / song.mp3 < / P>

Is there a way to tell the zip to reduce the path, or specify a custom path for each file?
Or is there any way that I can change the job, put the directory in the user's root backup folder so that I can only specify the relative file path.

Thank you for reading, hope you got it and it all makes sense!

I have a little question about why you are making a dangerous system shell call when many good PHP speeding classes Show how easily to create a square which will output a zip file to the browser. There are also many classes at Phpclasses.org,

If you have my suggestions for doing this with a system call:

The file you want Can use, to reduce its path.

Can not you increase the zip executable permissions that Apache can use without using sudo?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -