file-permissions

Android - How do I save a file that is readable by an other app?

大憨熊 提交于 2019-12-01 04:19:39
问题 I want to save a file and then fire an intent to an other application to open that file. How do I accomplish this? If tried : openFileOutput("file.pdf", Context.MODE_WORLD_READABLE) but doesn't seem to work. Should I save the file outside the applications folder? If so how do I pass it the correct permissions? 回答1: You can use something like this: String extPath = Environment.getExternalStorageDirectory().getAbsolutePath(); String pathPrefix = extPath + "/Android/data/" + APP_PACKAGE_ID + "

File Permissions and CHMOD: How to set 777 in PHP upon file creation?

回眸只為那壹抹淺笑 提交于 2019-12-01 03:21:30
A question aboud file permissions when saving a file that when non existent, is created initially as new file. Now, this all goes well, and the saved file appear to have mode 644 . What to I have to change here, in order to make the files save as mode 777 ? Thanks a thousand for any hints, clues or answers. The code that I think is relevant here I have included: /* write to file */ self::writeFileContent($path, $value); /* Write content to file * @param string $file Save content to wich file * @param string $content String that needs to be written to the file * @return bool */ private function

How to use batch file to give a folder permission to the Everyone group

允我心安 提交于 2019-12-01 03:18:35
Im trying to add the group Everyone and give it modify permissions on a folder. Im using a batch file to try this. so for I have icacls "C:\Program Files (x86)\Program File" /grant:r Everyone:M But when I go and look at the permissions on the folder nothing has been changed. No need to put :r after /grant . Check the examples by typing icacls /? Do like this: icacls "C:\Program Files (x86)\Program File" /grant Everyone:M 来源: https://stackoverflow.com/questions/23526361/how-to-use-batch-file-to-give-a-folder-permission-to-the-everyone-group

php chmod() not changing permissions

£可爱£侵袭症+ 提交于 2019-12-01 01:13:53
问题 I am having problems with a picture uploading script. I know there are hundreds of the same questions, but I haven't found the one that would be work for me. $upload_dir = "images/postcards/"; chmod($upload_dir, 777); if (is_writable($upload_dir)) { echo 'The file is writable'; } else { echo 'The file is not writable'; } This always returns that the file is "not writable" I tried setting chmod to 0777 and -rwxrwxrwx . But result was always the same. Any Ideas? 回答1: The directory must be owned

How to use batch file to give a folder permission to the Everyone group

…衆ロ難τιáo~ 提交于 2019-11-30 23:47:17
问题 Im trying to add the group Everyone and give it modify permissions on a folder. Im using a batch file to try this. so for I have icacls "C:\Program Files (x86)\Program File" /grant:r Everyone:M But when I go and look at the permissions on the folder nothing has been changed. 回答1: No need to put :r after /grant . Check the examples by typing icacls /? Do like this: icacls "C:\Program Files (x86)\Program File" /grant Everyone:M 来源: https://stackoverflow.com/questions/23526361/how-to-use-batch

File Permissions and CHMOD: How to set 777 in PHP upon file creation?

大兔子大兔子 提交于 2019-11-30 23:16:20
问题 A question aboud file permissions when saving a file that when non existent, is created initially as new file. Now, this all goes well, and the saved file appear to have mode 644 . What to I have to change here, in order to make the files save as mode 777 ? Thanks a thousand for any hints, clues or answers. The code that I think is relevant here I have included: /* write to file */ self::writeFileContent($path, $value); /* Write content to file * @param string $file Save content to wich file

How to set rw- r— r— permissions programmatically?

纵饮孤独 提交于 2019-11-30 20:27:16
I am developing an application that can restore apps' data back to /data/data/{packageName}. After restoring the files, I am setting the permissions to rw- r-- r--. I set it in this way: public int chmod(File path, int mode) throws Exception { Class fileUtils = Class.forName("android.os.FileUtils"); Method setPermissions = fileUtils.getMethod("setPermissions", String.class, int.class, int.class, int.class); return (Integer) setPermissions.invoke(null, path.getAbsolutePath(), mode, -1, -1); } and calling chmod(file, 644); But when I check these files' permissions in file explorer it shows me "-

cmake : How to change file permissions when installing?

大憨熊 提交于 2019-11-30 20:05:28
I have a file with 660 flags set, but I want to install it with 700 flags set. How do I do it? How to change the file permission, without changing the permissions of the source file? My install command is this : install( FILES common.sh DESTINATION /rootfs/usr/bin ) and this is what I tried (but it doesn't work) : install( FILES common.sh FILE_PERMISSIONS "600" DESTINATION /rootfs/usr/bin ) There is no FILE_PERMISSIONS argument in install(FILES ...) . Use PERMISSIONS instead: install( FILES common.sh PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION /rootfs/usr/bin ) 来源: https:/

File permission issue with Mac/Windows when using git

匆匆过客 提交于 2019-11-30 19:38:08
I ran the following code to pull files from windows git repository. git pull /Volumes/sucho/Desktop/git/setup And I connect the Windows directory as follows. tell application "Finder" mount volume "cifs://WINDOWS/c$/Users/sucho" as user name "USR" with password "PW" end tell It works well, but the problem is the pulled files from windows have 700 (rwx------). How can I set it 644(rw-r--r--) as default? This isn't really answering your original question, but I hope to highlight another issue I ran into when attempting to trying @drewag's proposed solution... Another issue I ran into when

How to make a “Read only” file?

你。 提交于 2019-11-30 18:59:30
I'm using the C# StreamWritier class. Questions: How can I make a file read-only, so that no one can delete or write to it? How can I make a hidden file? I'm creating the file like so: private void button1_Click(object sender, EventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.FileName = textBox1.Text; save.Filter = "Text File | *.rtf"; if (save.ShowDialog() == DialogResult.OK) { StreamWriter writer = new StreamWriter(save.OpenFile()); writer.WriteLine(textBox2.Text); } writer.Dispose(); writer.Close(); } Aghilas Yakoub Hello you can try with this method 1 public static void