Unable to open uploaded assignments with Internet Explorer

Unable to open uploaded assignments with Internet Explorer

by David O'Brien -
Number of replies: 24

We are using Moodle 1.5.1.  I have the problem in which I cannot open students' uploaded assignments with Internet Explorer 6.0.  Curiously I can open them with Mozilla Firefox.

The error message I get is: Internet Explorer was not able to open this internet site.  The requested site is either unavailable or cannot be found. Please try again later.

Average of ratings: -
In reply to David O'Brien

Re: Unable to open uploaded assignments with Internet Explorer

by Jim Weller -

David,

I'm having the same problem with Internet Explorer--did you figure out a fix?

Jim

In reply to Jim Weller

Re: Unable to open uploaded assignments with Internet Explorer

by David O'Brien -
Hi Jim, we moved to Moodle 1.5.2 and still have the same problem.  The thing is it worked under 1.4.5 sad
In reply to David O'Brien

Re: Unable to open uploaded assignments with Internet Explorer

by Mike Plagge -
We are having the same problem.  We're running Windows 2000 and IIS.  We have Moodle running on https.  Anyone find a fix/workaround, yet?
In reply to Mike Plagge

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Please look into lib/filelib.php, there is a clearly marked place regarding https and IE. You can try to comment out the line with @header('Pragma: no-cache');.

Anyway I would like to fix this in CVS, but I do not use either IE or Office - so I need a lot of your help wink

You can find some more info here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;812935

skodak
In reply to Petr Skoda

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Please test following patch:
Index: filelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/filelib.php,v
retrieving revision 1.11.2.3
diff -u -r1.11.2.3 filelib.php
--- filelib.php	12 Sep 2005 18:43:49 -0000	1.11.2.3
+++ filelib.php	13 Sep 2005 21:49:56 -0000
@@ -137,6 +137,7 @@
 }
 
 function send_file($path, $filename, $lifetime=86400 , $filter=false, $pathisstring=false,$forcedownload=false) {
+    global $CFG;
 
     $mimetype     = $forcedownload ? 'application/x-forcedownload' : mimeinfo('type', $filename);
     $lastmodified = $pathisstring ? time() : filemtime($path);
@@ -158,7 +159,9 @@
         // HTTPS:// sites might have problems with following code in IE, tweak it yourself if needed ;-)
         @header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=10');
         @header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT');
-        @header('Pragma: no-cache');
+        if (strpos($CFG->wwwroot, 'https://') !== 0) {
+            @header('Pragma: no-cache');
+        }
     }
     @header('Accept-Ranges: none'); // Comment out if PDFs do not work...
 

In reply to Petr Skoda

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Weird, isn't it? thoughtful Does it ask you to save the file?

You can also try to remove the word "private" from the cache control statement.
In reply to Petr Skoda

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Was it enought to take out "private" or did you comment out "Pragma: no-cache" too?
In reply to Petr Skoda

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Could you check the state of Do Not Save Encrypted Files setting in IE? According to KB above it must be off. If you have it on, try turning it off and retry the above changes.

Edit:

just found Q316431, try to remove "Pragma: no-cache" and "must-revalidate".

In reply to Petr Skoda

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Mike Plagge -

Mine was off as well. As of this morning, we are using http for general site usage and switching to https for the logins.  That has been working pretty well.

In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Do you have there "global $CFG;"?

Could you please try to remove also "must-revalidate"?
In reply to Petr Skoda

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
...looking at the code again, it might not be right to comment out the pragma, it should be cleared instead:
Index: filelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/filelib.php,v
retrieving revision 1.11.2.3
diff -u -r1.11.2.3 filelib.php
--- filelib.php	12 Sep 2005 18:43:49 -0000	1.11.2.3
+++ filelib.php	14 Sep 2005 21:04:05 -0000
@@ -137,6 +137,7 @@
 }
 
 function send_file($path, $filename, $lifetime=86400 , $filter=false, $pathisstring=false,$forcedownload=false) {
+    global $CFG;
 
     $mimetype     = $forcedownload ? 'application/x-forcedownload' : mimeinfo('type', $filename);
     $lastmodified = $pathisstring ? time() : filemtime($path);
@@ -153,12 +154,15 @@
         @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
         @header('Pragma: ');
     } else {
-        // This part is tricky, displaying of MS Office documents in IE needs
-        // to store the file on disk, but no-cache may prevent it.
-        // HTTPS:// sites might have problems with following code in IE, tweak it yourself if needed ;-)
-        @header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=10');
-        @header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT');
-        @header('Pragma: no-cache');
+        if (strpos($CFG->wwwroot, 'https://') === 0) { //https sites - watch out for IE!
+            @header('Cache-Control: max-age=10');
+            @header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT');
+            @header('Pragma: ');
+        } else { //normal http - prevent caching at all cost
+            @header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=10');
+            @header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT');
+            @header('Pragma: no-cache');
+        }
     }
     @header('Accept-Ranges: none'); // Comment out if PDFs do not work...
 

In reply to Petr Skoda

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Unable to open uploaded assignments with Internet Explorer

by Jodi Stiles -
Interesting - this fix doesn't work for me.  The only one I can get to work is the simple:

if ($lifetime > 0) {
        @header('Cache-control: max-age='.$lifetime);
        @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
        @header('Pragma: ');
    } else {
        // this part is tricky, displaying of MS Office documents in IE needs
        // to store the file on disk, but no-cache may prevent it
        @header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=10');
        @header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT');
       // @header('Pragma: no-cache');
       @header('Pragma: ');
    }
In reply to Jodi Stiles

Re: Unable to open uploaded assignments with Internet Explorer

by Paolo Oprandi -
Thanks skodak, jodi,

Removing the pragma:no-cache (as jodi said) was enough for us.

Paolo
In reply to Mike Plagge

Re: Unable to open uploaded assignments with Internet Explorer

by Mike Plagge -
I was looking through the bug reports and did not find a bug report on this.  Has anyone submitted a bug report on it, yet?

There seems to be a similar problem with students uploading assignments in IE/XP with Word documents.  http://moodle.org/mod/forum/discuss.php?d=2422

In reply to David O'Brien

Re: Unable to open uploaded assignments with Internet Explorer

by Richard Williamson -

I'm not using HTTPS, but when I try to download an assignment saved in Word or Publisher (forgive me!), I get an option to save or open. If I open, I get a Word error saying that the file could not be found. It gives a snippet of a path at the end which points to the local hard drve. Is I opt to save, it saves fine.

Any help would be much appreciated!!
Richard W

In reply to David O'Brien

Re: Unable to open uploaded assignments with Internet Explorer

by Cory B -
I've had luck having people with IE try to open files in a new window. It's not the best fix, but it has worked for me in every IE browser that used to break.
In reply to Cory B

Re: Unable to open uploaded assignments with Internet Explorer

by aggelos panagiotakis -
i tried a lot with many options and workarounds but ie and firefox dont seem to get it right. just pop up a window (and maybe no window at all) and prompt the user to save the file.
is there a way for some all file resources to add something to enable the user to just use the right click and "save as..." method?
that would be really helpfull
In reply to David O'Brien

Re: Unable to open uploaded assignments with Internet Explorer

by Erick Fonseca -
I had this error today, using Moodle 1.9.5.
In one machine, I couldn't download an assignment via IE, only in Firefox.
Then I tried in another machine, and it worked in both browsers. I don't know what could have caused the problem.
The last post in this thread is from 2006, is anyone else having this error?