fileinfo

Application Settings + DirectoryInfo/FileInfo

无人久伴 提交于 2019-12-07 18:21:53
问题 I'm still new to C#... I'm building a WPF application and I'm trying to apply some User Application Settings. It's easy to insert standard App Settings (int, double, string, etc). I've even got something like WindowState inserted. I'd like to have a DirectoryInfo and/or FileInfo as savable settings instead of Strings. Selected type: System.IO.File gives an error message "Abstract types are not supported". Which makes sense, since how can you implement an abstract type as a setting. Selected

Fetching the username who last modified or created the file

ぃ、小莉子 提交于 2019-12-07 15:05:02
问题 Is it possible to get the name of the user who just pasted a file into a folder? A brief overview of what I am trying to do: My application keeps watch on a folder for new files every 10 minutes. If it finds any new file it will upload that file via FTP to a specified location. I would like to know who dropped this file into the folder. Please note that this could be different from the person who created the file. Thanks Nishant 回答1: The identity of the user modifying a file is not stored in

fileinfo and mime types I've never heard of

痴心易碎 提交于 2019-12-07 11:00:30
问题 I'm not a stranger to mime types but this is strange. Normally, a text file would have been considered to be of text/plain mime but now, after implementing fileinfo, this type of file is now considered to be "text/x-pascal". I'm a little concerned because I need to be sure that I get the correct mime types set before allowing users to upload with it. Is there a cheat sheet that will give me all of the "common" mimes as they are interpreted by fileinfo? Sinan provided a link that lists all of

Mime type detection fails with fileinfo on PHP 5.3.8

左心房为你撑大大i 提交于 2019-12-07 06:08:49
问题 I'm having trouble detecting the mime type of a simple PNG file with fileinfo, with PHP 5.3.8 installed on a CentOS server. The problem Basically, if I have the following code : <?php $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; $handle = finfo_open($const, '/usr/share/file/magic.mime'); $result = finfo_file($handle, '/var/vhosts/v4dev/public/Melvin.png'); echo $result; unset($handle); ?> As you can see the file is a PNG image. The header bytes of the file has

Fetching the username who last modified or created the file

杀马特。学长 韩版系。学妹 提交于 2019-12-06 00:21:24
Is it possible to get the name of the user who just pasted a file into a folder? A brief overview of what I am trying to do: My application keeps watch on a folder for new files every 10 minutes. If it finds any new file it will upload that file via FTP to a specified location. I would like to know who dropped this file into the folder. Please note that this could be different from the person who created the file. Thanks Nishant Krzysztof Kozielczyk The identity of the user modifying a file is not stored in the NTFS Change Journal , but you could use auditing of file access as suggested in

fileinfo and mime types I've never heard of

偶尔善良 提交于 2019-12-05 14:29:14
I'm not a stranger to mime types but this is strange. Normally, a text file would have been considered to be of text/plain mime but now, after implementing fileinfo, this type of file is now considered to be "text/x-pascal". I'm a little concerned because I need to be sure that I get the correct mime types set before allowing users to upload with it. Is there a cheat sheet that will give me all of the "common" mimes as they are interpreted by fileinfo? Sinan provided a link that lists all of the more common mimes. If you look at this list, you will see that a .txt file is of text/plain mime

php常见扩展

拥有回忆 提交于 2019-12-05 09:51:06
#####php常用扩展安装 ######php扩展 扩展帮助信息 http://pecl.php.net/ ######fileinfo 1、下载的php版本中自带有 cd /path/php/ext/fileinfo phpize ./configure --with-php-config=/path/php/bin/php-config make make install 2、在peclphp.net/搜索下载安装 ######msgpack 在peclphp.net/搜索下载安装 注意:版本是否适合php的版本 wget "http://pecl.php.net/get/msgpack-0.5.7.tgz" tar zxf msgpack-0.5.7.tgz cd msgpack-0.5.7 /usr/local/php/bin/phpize ./configure --with-msgpack make make install 最后修改下php.ini文件 extension = "msgpack.so" #######imap php安装包内含有 安装依赖包 yum install -y libc-client-* cd /path/php/ext/fileinfo phpize ./configure --with-php-config=/path/php/bin

Mime type detection fails with fileinfo on PHP 5.3.8

依然范特西╮ 提交于 2019-12-05 09:37:17
I'm having trouble detecting the mime type of a simple PNG file with fileinfo, with PHP 5.3.8 installed on a CentOS server. The problem Basically, if I have the following code : <?php $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; $handle = finfo_open($const, '/usr/share/file/magic.mime'); $result = finfo_file($handle, '/var/vhosts/v4dev/public/Melvin.png'); echo $result; unset($handle); ?> As you can see the file is a PNG image. The header bytes of the file has been checked and are correct. But this page outputs an incorrect result : application/octet-stream I

Does FileInfo.Extension return the last *.* pattern, or something else?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 09:06:27
问题 I'm curious what exactly the behavior is on the following: FileInfo info = new FileInfo("C:/testfile.txt.gz"); string ext = info.Extension; Will this return ".txt.gz" or ".gz"? What is the behavior with even more extensions, such as ".txt.gz.zip" or something like that? EDIT: To be clear, I've already tested this. I would like an explanation of the property. 回答1: It will return .gz, but the explanation from MSDN (FileSystemInfo.Extension Property) isn't clear why: " The Extension property

SPLFileInfo: get filename without extension

有些话、适合烂在心里 提交于 2019-12-04 17:54:50
问题 I'm accessing a number of files in the SPLFileInfo object. I see a way to get the path, filename, and even extension of the file. Is there a way to get the filename without extension? Here's the code I've been working with but I'm hoping to get something more elegant. Is there an out of the box solution? $file = new SplFileInfo("path/to/file.txt.zip"); echo 'basename: '.$file->getBasename(); echo PHP_EOL; echo 'filename: '.$file->getFilename(); echo PHP_EOL; echo 'extension: '.$file-