Hello,
I have created a webpage where I use a simple command line tool [oggz-tool] to cut a section of the video. It works fine but the only problem is that when the new file is created, it is owned by www-data and not by the user I created which is history. How can I change this default ownership of the new file without doing it manually everytime?

I have searched and tried various commands like umask and setid but nothing that works for files created through the webpage. Any help would be nice. Thanks.

Here,s the code.

<html>
  <body>
		
<?php
		$s = 10;
		$e = 55;

		
		system('oggz-chop --start $s --end $e elephant.ogv -o section.ogv',$returnval);
		
		
?>

		<video src="section.ogv" width="800" height="600" controls>
		</video>
		
  </body>
</html>

So I am talking about the output file section.ogv which doesnt get the right permissions.

Recommended Answers

All 3 Replies

The file is set to the account that creates the file which is normal. Changing the owner is probably not necessary but altering the file permissions to allow the file to be executed is.

Maybe something like this?

<?php
	$s = 10;
	$e = 55;
	
	system('oggz-chop --start $s --end $e elephant.ogv -o section.ogv',$returnval);
	chmod("section.ogv", 0755);
?>

The file is set to the account that creates the file which is normal. Changing the owner is probably not necessary but altering the file permissions to allow the file to be executed is.

Maybe something like this?

<?php
	$s = 10;
	$e = 55;
	
	system('oggz-chop --start $s --end $e elephant.ogv -o section.ogv',$returnval);
	chmod("section.ogv", 0755);
?>

I tried that but no luck ... the only way it seems to work is if I do : sudo chown history section.ogv but I have to do that manually on the server.

Can anybody help?!? I am still trying to figure this out.... I also tried using umask through my php script but that did not make any difference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.