Results 1 to 5 of 5

Thread: Download Issue in IIS 6.0

  1. #1
    jgrenfell is offline Member
    Join Date
    Oct 2006
    Posts
    7

    Default Download Issue in IIS 6.0

    This is only an issue if you're running IIS 6.0 as your web server (or possibly only if you're running on a 64-bit server, but I doubt that). Every time I tried to download a file that had been uploaded to the Documents module, the resulting file would appear to be corrupted and could not be opened by the associated application, even though the file in cache/upload opened fine if I just added the extension to it. This was not an issue on my IIS 5.0 server, however. After pulling my hair out for a couple days, I found a fix for it which only requires one additional line of code in download.php. The ob_end_clean() function removes a prefixed CR/LF pair from file which was causing the application opening it to see the file as corrupt.

    I tested this fix on my IIS 5.0 server and the download function still worked. Should be tested on other web servers and added to Sugar source code if it doesn't cause any issues. I'm hoping this saves someone the headache I went through to fix this.

    In download.php, insert the following

    //Inserted code
    ob_end_clean();

    //Existing code for placement reference
    ob_start();

    if (filesize($local_location) < 2097152) {
    readfile($download_location);
    } else {
    readfile_chunked($download_location);
    }
    @ob_flush();

  2. #2
    wjohnson is offline Sugar Community Member
    Join Date
    Dec 2005
    Posts
    242

    Default Re: Download Issue in IIS 6.0

    What version of Sugar are you using? I believe we experienced the same problem but that the bug was fixed in an upgrade.

  3. #3
    jgrenfell is offline Member
    Join Date
    Oct 2006
    Posts
    7

    Default Re: Download Issue in IIS 6.0

    Good point, I should have specified that. I'm on OS 4.5.0h.

  4. #4
    wjohnson is offline Sugar Community Member
    Join Date
    Dec 2005
    Posts
    242

    Default Re: Download Issue in IIS 6.0

    We actually don't use the documents module but it was happening when trying to open a document attached to an email or a note. I just tested on 4.5.1a and I didn't notice it occurring.

  5. #5
    jgrenfell is offline Member
    Join Date
    Oct 2006
    Posts
    7

    Default Re: Download Issue in IIS 6.0

    I was seeing it on any file I was downloading, Documents and in some custom modules I developed, so it wasn't Documents specific. Sounds like it's probably fixed, but there were other similar issues with different causes that I know have been fixed since and there is that outside chance that this had something to do with my running Sugar on a 64-bit server, which did complicate the initial setup of php and Sugar. Hopefully someone with IIS 6.0 on a 32bit server can test and confirm that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. php_mbstring.dll will not load in IIS 6.0
    By sfreeman in forum Help
    Replies: 6
    Last Post: 2006-09-19, 09:51 PM
  2. Sugar CRM With IIS 6.0
    By sajidfiaz in forum General Discussion
    Replies: 1
    Last Post: 2006-04-20, 10:45 AM
  3. Error when installing on a IIS 6.0
    By tgra953 in forum General Discussion
    Replies: 2
    Last Post: 2005-09-29, 07:59 PM
  4. Iis Password Issue
    By theHitman in forum Help
    Replies: 0
    Last Post: 2005-07-27, 09:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •