Search Results

Search found 266 results on 11 pages for 'fileinfo'.

Page 1/11 | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >

  • "Unable to initialize module" fileinfo php-pecl-Fileinfo.x86_64

    - by Myers Network
    I have a brand new server server that I am trying to get setup up. This is a 64 bit machine that I can not install "fileinfo" or "memcache". I have uninstalled these and reinstalled them using yum and pecl with no luck. Yum install fine "no error" but then get error when running php. pecl from what I can tell is only installing 32bit. Does not put anything in the lib64 directory. Here is my output from php -v: PHP Warning: PHP Startup: fileinfo: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 PHP 5.2.14 (cli) (built: Aug 12 2010 16:03:48) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies Here is some other system info incase you need it uname: Linux server.actham.us 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux php -m: PHP Warning: PHP Startup: fileinfo: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 [PHP Modules] bz2 calendar ctype curl date dbase dom exif filter ftp gd gettext gmp hash iconv imap json ldap libxml mbstring mcrypt mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite readline Reflection session shmop SimpleXML sockets SPL standard tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib [Zend Modules] Any help would be greatly appreciated, thanks....

    Read the article

  • "Unable to initialize module" fileinfo php-pecl-Fileinfo.x86_64

    - by Myers Network
    I have a brand new server server that I am trying to get setup up. This is a 64 bit machine that I can not install "fileinfo" or "memcache". I have uninstalled these and reinstalled them using yum and pecl with no luck. Yum install fine "no error" but then get error when running php. pecl from what I can tell is only installing 32bit. Does not put anything in the lib64 directory. Here is my output from php -v: PHP Warning: PHP Startup: fileinfo: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 PHP 5.2.14 (cli) (built: Aug 12 2010 16:03:48) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies Here is some other system info incase you need it uname: Linux server.actham.us 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux php -m: PHP Warning: PHP Startup: fileinfo: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 [PHP Modules] bz2 calendar ctype curl date dbase dom exif filter ftp gd gettext gmp hash iconv imap json ldap libxml mbstring mcrypt mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite readline Reflection session shmop SimpleXML sockets SPL standard tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib [Zend Modules] Any help would be greatly appreciated, thanks....

    Read the article

  • Blank space after file extension -> weird FileInfo behaviour

    - by Axarydax
    Somehow a file has appeared in one of my directories, and it has space at the end of its extension - its name is "test.txt ". The weird thing is that Directory.GetFiles() returns me the path of this file, but I'm unable to retrieve file information with FileInfo class. The error manifests here: DirectoryInfo di = new DirectoryInfo("c:\\somedir"); FileInfo fi = di.GetFileSystemInfos("test*")[0] as FileInfo; //correctly fi.FullName is "c:\somedir\test.txt " //but fi.Exists==false (!) Is FileInfo class broken? Can I somehow retrieve information about this file? I really don't know how did that file appear on my file system, and I am unable to recreate some more of them. All of my attempts to create a new file with this type of extension have failed, but now my program is crashing when encoutering it. I can easily handle the exception when finding the file, but boy am I curious about this!

    Read the article

  • How is FileInfo Serialized?

    - by Josh G
    I want to save file metadata (mostly path/name) along with the contents of the file. I noticed that FileInfo is serializable. Does anyone know data is serialized when you save a FileInfo object? I would assume that only metadata is saved, not the contents of the file?

    Read the article

  • Apache : Illegal override option FileInfo

    - by Kave
    I have installed a new Ubuntu 12.04 Server and setup Apache and MySQL. I am just trying to replicate what I have in my current server and came across one single problem. - FileInfo Within these two files below: /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default I need to add some overrides for the apache server. Original: <Directory /var/www/MySite> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> New: <Directory /var/www/MySite> Options Indexes FollowSymLinks MultiViews AllowOverride FileInfo, Indexes Order allow,deny allow from all </Directory> I have installed the following mods for Apache: sudo apt-get install lamp-server^ -y sudo apt-get install apache2.2-common apache2-utils openssl openssl-blacklist openssl-blacklist-extra -y sudo apt-get install curl libcurl3 libcurl3-dev php5-curl -y sudo apt-get install php5-tidy -y sudo apt-get install php5-gd -y sudo apt-get install php-apc -y sudo apt-get install memcached -y sudo apt-get install php5-memcache -y sudo a2enmod ssl sudo a2enmod rewrite sudo a2enmod headers sudo a2enmod expires sudo a2enmod php5 So When I do a restart with AllowOverride None, its all ok. sudo /etc/init.d/apache2 restart * Restarting web server apache2 ... waiting [OK] But as soon as I change the AllowOverride to FileInfo, Indexes Syntax error on line 11 of /etc/apache2/sites-enabled/000-default: Illegal override option FileInfo, Action 'configtest' failed. The Apache error log may have more information. ...fail! I can't see anything unusual in the error.log [Wed Jun 06 08:23:51 2012] [notice] caught SIGTERM, shutting down [Wed Jun 06 08:23:52 2012] [warn] RSA server certificate CommonName (CN) `mySite.com' does NOT match server name!? [Wed Jun 06 08:23:52 2012] [warn] RSA server certificate CommonName (CN) `mySite.com' does NOT match server name!? [Wed Jun 06 08:23:52 2012] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.1 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/1.0.1 configured -- resuming normal operations I get that warning because its a test server, nonetheless I get the same warning with AllowOverride None and yet it restarts the Apache server correctly. Therefore this warning should be harmless. Have I missed something? Thanks,

    Read the article

  • C# DriveInfo FileInfo

    - by maxfridbe
    This may seem like a stupid question, so here goes: Other than parsing the string of FileInfo.FullPath for the drive letter to then use DriveInfo("c") etc to see if there is enough space to write this file. Is there a way to get the drive letter from FileInfo?

    Read the article

  • FileInfo.MoveTo() vs File.Move()

    - by Eric
    Is there any difference between these two methods of moving a file? System.IO.FileInfo f = new System.IO.FileInfo(@"c:\foo.txt"); f.MoveTo(@"c:\bar.txt"); //vs System.IO.File.Move(@"c:\foo.txt", @"c:\bar.txt");

    Read the article

  • C# System.IO.FileInfo gets virtual address which has sessions key

    - by Anicho
    Okay so the following line returns null because its path cannot be found: System.IO.FileInfo fi = di.GetFiles()[position]; What I am currently doing is: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <ctl:Gallery runat="server" ID="Gallery1" FolderUrl="~/images/1/" Size="100" /> When this is invoked System.IO.FileInfo fi = di.GetFiles()[position]; it has the value similar to this: C:\Users\SomeUsername\Desktop\Tiamo\(S(mr1h0l55ycuixfbtqxbmttek))\images\1 Any idea how I can return the virtual path without actually having the session key in there? Thank you in advanced for any help you may give :) much appreciated.

    Read the article

  • fileinfo and mime types I've never heard of

    - by Jim
    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 but in my case, a plain-jane text file is interpreted as text/pascal.

    Read the article

  • Good reasons to pass paths as strings instead of using DirectoryInfo/FileInfo

    - by neodymium
    In my new code I am not using strings to pass directory paths or file names. Instead I am using DirectoryInfo and FileInfo as they seem to encapsulate a lot of information. I have seen a lot of code that uses strings to pass directory information then they "split" and "mid" and "instr" in long incomprehensible statements until they get the part of the directory they are looking for. Is there any good reason to pass paths as strings?

    Read the article

  • FileInfo displaying a peculiar date

    - by Berlioz
    Why does the following display 12/31/1600 ??? Imports System.IO Module Module1 Sub Main() Dim fi As New FileInfo("DocFiles\phillips_phone_number.txt") Console.WriteLine(fi.FullName) Console.WriteLine(fi.LastAccessTime.ToShortDateString) Console.ReadKey() End Sub End Module

    Read the article

  • Correct way of setting a custom FileInfo class to an Iterator

    - by Gordon
    I am trying to set a custom class to an Iterator through the setInfoClass method: Use this method to set a custom class which will be used when getFileInfo and getPathInfo are called. The class name passed to this method must be derived from SplFileInfo. My class is like this (simplified example): class MyFileInfo extends SplFileInfo { public $props = array( 'foo' => '1', 'bar' => '2' ); } The iterator code is this: $rit = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('/some/file/path/'), RecursiveIteratorIterator::SELF_FIRST); Since RecursiveDirectoryIterator is by inheritance through DirectoryIterator also an SplFileInfo object, it provides the setInfoClass method (it's not listed in the manual, but reflection shows it's there). Thus I can do: $rit->getInnerIterator()->setInfoClass('MyFileInfo'); All good up to here, but when iterating over the directory with foreach($rit as $file) { var_dump( $file ); } I get the following weird result object(MyFileInfo)#4 (3) { ["props"]=>UNKNOWN:0 ["pathName":"SplFileInfo":private]=>string(49) "/some/file/path/someFile.txt" ["fileName":"SplFileInfo":private]=>string(25) "someFile.txt" } So while MyFileInfo is picked up, I cannot access it's properties. If I add custom methods, I can invoke them fine, but any properties are UNKNOWN. If I don't set the info class to the iterator, but to the SplFileInfo object (like shown in the example in the manual), it will give the same UNKNOWN result: foreach($rit as $file) { // $file is a SplFileInfo instance $file->setInfoClass('MyFileInfo'); var_dump( $file->getFileInfo() ); } However, it will work when I do foreach($rit as $file) { $file = new MyFileInfo($file); var_dump( $file ); } Unfortunately, the code I a want to use this in is somewhat more complicated and stacks some more iterators. Creating the MyFileInfo class like this is not an option. So, does anyone know how to get this working or why PHP behaves this weird? Thanks.

    Read the article

  • FileInfo..ctor(string fileName) throwing exception: bug in SL 4.0 or .NET 4.0?

    - by Duncan Bayne
    The following test case passes in .NET 4.0: var fiT = new FileInfo("myhappyfilename"); Assert.IsNotNull(fiT); ... but fails in Silverlight 4.0 with the following error: System.ArgumentNullException: Value cannot be null. Parameter name: format at System.String.Format(IFormatProvider provider, String format, Object[] args) at System.Environment.GetResourceString(String key, Object[] values) at System.IO.FileSecurityState.EnsureState() at System.IO.FileInfo.Init(String fileName, Boolean checkHost) at System.IO.FileInfo..ctor(String fileName) Either the failure is a bug in SL 4.0, or the non-failure is a bug in .NET 4.0. Anyone know which it is? (For the record, I'm running SL 4.0 on VS 2010 RC, which may be contributing to the problem).

    Read the article

  • Can I convert a Stream object to a FileInfo object?

    - by Michael
    For the ExcelPackage constructor you need a FileInfo object. I rather use some kind of stream object(f.i. MemoryStream), because I don't need to save the file to the server itself, but expose it as a FileStream anyway to the user. I don't want to make files which I have to delete lateron from servers which are only there for generating purposes and never used again. Apart from that, otherwise I need also the necessary rights for the application/user on the directory/file on the server. So my question is then: How can I convert a stream object to a FileInfo object.

    Read the article

  • Populate a WCF syndication podcast using MP3 ID3 metadata tags

    - by brian_ritchie
    In the last post, I showed how to create a podcast using WCF syndication.  A podcast is an RSS feed containing a list of audio files to which users can subscribe.  The podcast not only contains links to the audio files, but also metadata about each episode.  A cool approach to building the feed is reading this metadata from the ID3 tags on the MP3 files used for the podcast. One library to do this is TagLib-Sharp.  Here is some sample code: .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } 1: var taggedFile = TagLib.File.Create(f); 2: var fileInfo = new FileInfo(f); 3: var item = new iTunesPodcastItem() 4: { 5: title = taggedFile.Tag.Title, 6: size = fileInfo.Length, 7: url = feed.baseUrl + fileInfo.Name, 8: duration = taggedFile.Properties.Duration, 9: mediaType = feed.mediaType, 10: summary = taggedFile.Tag.Comment, 11: subTitle = taggedFile.Tag.FirstAlbumArtist, 12: id = fileInfo.Name 13: }; 14: if (!string.IsNullOrEmpty(taggedFile.Tag.Album)) 15: item.publishedDate = DateTimeOffset.Parse(taggedFile.Tag.Album); This reads the ID3 tags into an object for later use in creating the syndication feed.  When the MP3 is created, these tags are set...or they can be set after the fact using the Properties dialog in Windows Explorer.  The only "hack" is that there isn't an easily accessible tag for "subtitle" or "published date" so I used other tags in this example. Feel free to change this to meet your purposes.  You could remove the subtitle & use the file modified data for example. That takes care of the episodes, for the feed level settings we'll load those from an XML file: .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } 1: <?xml version="1.0" encoding="utf-8" ?> 2: <iTunesPodcastFeed 3: baseUrl ="" 4: title="" 5: subTitle="" 6: description="" 7: copyright="" 8: category="" 9: ownerName="" 10: ownerEmail="" 11: mediaType="audio/mp3" 12: mediaFiles="*.mp3" 13: imageUrl="" 14: link="" 15: /> Here is the full code put together. Read the feed XML file and deserialize it into an iTunesPodcastFeed classLoop over the files in a directory reading the ID3 tags from the audio files .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } 1: public static iTunesPodcastFeed CreateFeedFromFiles(string podcastDirectory, string podcastFeedFile) 2: { 3: XmlSerializer serializer = new XmlSerializer(typeof(iTunesPodcastFeed)); 4: iTunesPodcastFeed feed; 5: using (var fs = File.OpenRead(Path.Combine(podcastDirectory, podcastFeedFile))) 6: { 7: feed = (iTunesPodcastFeed)serializer.Deserialize(fs); 8: } 9: foreach (var f in Directory.GetFiles(podcastDirectory, feed.mediaFiles)) 10: { 11: try 12: { 13: var taggedFile = TagLib.File.Create(f); 14: var fileInfo = new FileInfo(f); 15: var item = new iTunesPodcastItem() 16: { 17: title = taggedFile.Tag.Title, 18: size = fileInfo.Length, 19: url = feed.baseUrl + fileInfo.Name, 20: duration = taggedFile.Properties.Duration, 21: mediaType = feed.mediaType, 22: summary = taggedFile.Tag.Comment, 23: subTitle = taggedFile.Tag.FirstAlbumArtist, 24: id = fileInfo.Name 25: }; 26: if (!string.IsNullOrEmpty(taggedFile.Tag.Album)) 27: item.publishedDate = DateTimeOffset.Parse(taggedFile.Tag.Album); 28: feed.Items.Add(item); 29: } 30: catch 31: { 32: // ignore files that can't be accessed successfully 33: } 34: } 35: return feed; 36: } Usually putting a "try...catch" like this is bad, but in this case I'm just skipping over files that are locked while they are being uploaded to the web site.Here is the code from the last couple of posts.  

    Read the article

  • How can I bind a instance of a custom class to a WPF TreeListView without bugs?

    - by user327104
    First, from : http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx I get a nice TreeListView. I left the original classes (TreeListView, TreeListItemView, and LevelToIndentConverter) intact, the only code y have Added is on the XAML, here is it: <Style TargetType="{x:Type l:TreeListViewItem}"> .... </ControlTemplate.Triggers> <ControlTemplate.Resources> <HierarchicalDataTemplate DataType="{x:Type local:FileInfo}" ItemsSource="{Binding Childs}"> </HierarchicalDataTemplate> </ControlTemplate.Resources> </ControlTemplate> ... here is my custom class public class FileInfo { private List<FileInfo> childs; public FileInfo() { childs = new List<FileInfo>(); } public bool IsExpanded { get; set; } public bool IsSelected { get; set; } public List<FileInfo> Childs { get { return childs; } set { } } public string FileName { get; set; } public string Size { get; set; } } And before I use my custom class I remove all the items inside the treeListView1: <l:TreeListView> <l:TreeListView.Columns> <GridViewColumn Header="Name" CellTemplate="{StaticResource CellTemplate_Name}" /> <GridViewColumn Header="IsAbstract" DisplayMemberBinding="{Binding IsAbstract}" Width="60" /> <GridViewColumn Header="Namespace" DisplayMemberBinding="{Binding Namespace}" /> </l:TreeListView.Columns> </l:TreeListView> So finaly I add this code to bind a Instance of my class to the TreeListView: private void Window_Loaded(object sender,RoutedEventArgs e) { FileInfo root = new FileInfo() { FileName = "mis hojos", Size="asdf" }; root.Childs.Add(new FileInfo(){FileName="sub", Size="123456" }); treeListView1.Items.Add(root); root.Childs[0].Childs.Add(new FileInfo() { FileName = "asdf" }); root.Childs[0].IsExpanded = true; } So the bug is that the button to expand the elementes dont appear and when a node is expanded by doble click the child nodes dont look like child nodes. Please F1 F1 F1 F1 F1 F1 F1 F1.

    Read the article

  • What is the difference between File and FileInfo in C# ?

    - by Lilitu88
    I've been reading that the static methods of the File Class are better used to perform small and few tasks on a file like checking to see if it exists and that we should use an instance of the FileInfo Class if we are going to perform many operations on a specific file. I understand this and can simply use it that way blindly but I would like to know why is there a difference ? What is it about the way they work that make them suitable for different situations ? What is the point of having this 2 different classes that seem do the same in different ways ? It would be helpful if someone could answer at least one of this questions.

    Read the article

  • Is php fileinfo sufficient to prevent upload of malicious files?

    - by Scarface
    Hey guys, I have searched around a bit, and have not really found a professional type response to how to have secure fileupload capability so I wanted to get the opinion of some of the experts on this site. I am currently allowing upload of mp3s and images, and while I am pretty confident in preventing xss and injection attacks on my site, I am not really familiar with fileupload security. I basically just use php fileinfo and check an array of accepted filetypes against the filetype. For images, there is the getimagesize function and some additional checks. As far as storing them, I just have a folder within my directory, because I want the users to be able to use the files. If anyone could give me some tips I would really appreciate it.

    Read the article

  • convert from physical path to virtual path

    - by user710502
    I have this function that gets the fileData as a byte array and a file path. The error I am getting is when it tries to set the fileInfo in the code bewlo. It says 'Physical Path given, Virtual Path expected' public override void WriteBinaryStorage(byte[] fileData, string filePath) { try { // Create directory if not exists. System.IO.FileInfo fileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath(filePath)); //when it gets to this line the error is caught if (!fileInfo.Directory.Exists) { fileInfo.Directory.Create(); } // Write the binary content. System.IO.File.WriteAllBytes(System.Web.HttpContext.Current.Server.MapPath(filePath), fileData); } catch (Exception) { throw; } } When debugging it, is providing the filePath as "E:\\WEBS\\webapp\\default\\images\\mains\\myimage.jpg" . And the error message is 'E:/WEBS/webapp/default/images/mains/myimage.jpg' is a physical path, but a virtual path was expected. Also, what it is triggering this to happen is the following call properties.ResizeImage(imageName, Configurations.ConfigSettings.MaxImageSize, Server.MapPath(Configurations.EnvironmentConfig.LargeImagePath));

    Read the article

  • How to download .txt file from a url?

    - by Colin Roe
    I produced a text file and is saved to a location in the project folder. How do I redirect them to the url that contains that text file, so they can download the text file. CreateCSVFile creates the csv file to a file path based on a datatable. Calling: string pth = ("C:\\Work\\PG\\AI Handheld Website\\AI Handheld Website\\Reports\\Files\\report.txt"); CreateCSVFile(data, pth); And the function: public void CreateCSVFile(DataTable dt, string strFilePath) { StreamWriter sw = new StreamWriter(strFilePath, false); int iColCount = dt.Columns.Count; for (int i = 0; i < iColCount; i++) { sw.Write(dt.Columns[i]); if (i < iColCount - 1) { sw.Write(","); } } sw.Write(sw.NewLine); // Now write all the rows. foreach (DataRow dr in dt.Rows) { for (int i = 0; i < iColCount; i++) { if (!Convert.IsDBNull(dr[i])) { sw.Write(dr[i].ToString()); } if (i < iColCount - 1) { sw.Write(","); } } sw.Write(sw.NewLine); } sw.Close(); Response.WriteFile(strFilePath); FileInfo fileInfo = new FileInfo(strFilePath); if (fileInfo.Exists) { //Response.Clear(); //Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name); //Response.AddHeader("Content-Length", fileInfo.Length.ToString()); //Response.ContentType = "application/octet-stream"; //Response.Flush(); //Response.TransmitFile(fileInfo.FullName); } }

    Read the article

  • Why does copying a file using FileInfo.CopyTo creates the destination copied file as readonly ?

    - by Puneet Dudeja
    I have two folders in my asp.net web application in which I create new folders programmaticaly. The entire solution is under VSS source control. I was not able to manipulate these two folders programmably. For that, I gave {MACHINE}\ASPNET user account full control over these two folders. Still, the "access denied to the path" error was coming. I saw that these entire folders were marked readonly. I tried to uncheck Readonly from explorer but not successfull, readonly check does not get removed. Also, if I copy files using method, the destinationn copied file becomes readonly. I have also tried File.SetAttributes(path,FileAttributes.Normal); but no success. How can I make the copied file not READONLY ?

    Read the article

1 2 3 4 5 6 7 8 9 10 11  | Next Page >