Community Support for OpenDocMan (Deprecated)

Full Version: View function for excel (xls) does not work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

2008-07-10 09:47:53 PDT
I am having a hard time figuring out how to get the 'View' function to work. Here is the step to reproduce the problem. I have tried the mimetype sugguestions but the "view" function still does not work. "Download" button seems to work fine.

1. Add an excel file (test.xls) to the document listing
2. Click on the "view" icon next to it.

- OR -

1. Add an excel file (test.xls) to the document listing
2. click on the file name link
3. From file details page, click on the View icon
4. click on the link where it says, "To view your file in a new window <link>Click Here</link>"

Trying either steps, the browser(IE 7) opens another window and it shows garbage characters in it. Has anyone figured out how to get this "View" function to work properly? Thanks in advance for any help on this.

2008-07-10 10:05:33 PDT
Works for me... (Server: ODM 1.2.5, Apache 2.0.40; Client: Fedora 9, Firefox 3.0)

When you roll your mouse over the "View" icon, does IE display the URL? With Firefox, the status bar at the bottom of the screen shows the URL, which ends in "mimetype=application/"

What are you using for a webserver? Have you looked at the ODM mimetypes.php file?

2008-07-11 10:38:40 PDT
Here is the detail on my environment: ODM 1.2.5, Apache 2.0.52, Red Hat Enterprise Linux 4 and Internet Explorer 7.0.

When I mouse over the "View" icon using IE 7.0 and Firefox 2.0, I get the following on the status bar (no mimetype):

<!-- m --><a class="postlink" href=""> ... &mimetype=</a><!-- m -->

The link shows up on the status bar the same way when I mouse over the "Click Here" link.

In the mimetypes.php file, there is a entry (line 46) for excel file type as following:

$mimetypes['xls'] = 'application/';

Also, both config.php and config_local.php has entry for excel as following:

// List of allowed file types
// Pay attention to the "Last Message:" in the status bar if your file is being rejected
// because of its file type. It should display the proper MIME type there, and you can
// then add that string to this list to allow it
$GLOBALS['allowedFileTypes'] = array('image/gif', 'text/html', 'text/plain', 'application/pdf', 'application/x-pdf', 'application/x-lyx', 'application/msword', 'image/jpeg', 'image/pjpeg', 'image/png','application/msaccess', 'text/richtxt', 'application/mspowerpoint', 'application/octet-stream', 'application/x-zip-compressed','image/tiff','image/tif','application/','application/');

Any clue to what is not set up correctly?


2008-07-11 15:44:44 PDT
there should be a mimetype listed in the blue status bar that run across the screen in opendocman. On the right side will be the mimetype found. Try to add a file and see what mimetype is displaying in that area.

2008-07-14 05:45:43 PDT
Is your /etc/mime.types file readable by the webserver user?

Is there an entry for "xls" in that file?

Looking at the code in view_file.php that creates the URL, shows that the mimetype is determined by the extention on the file, (aka the part following the last "dot" in the filename) See lines 55-56 of view_file.php. The mimetype is not determined by the "content" of the file, only the extension.

What filename is displayed when you view the file listing ?

2008-07-14 05:54:07 PDT
Another test would be to copy the file to some place (outside ODM) on your webserver, and see if you can properly access it. If you still get "garbage", then you know it's a webserver or browser issue, not an ODM issue.

2008-07-15 13:53:18 PDT
The /etc/mime.types file is readable by webserver, and the following entry is there for "xls"

application/ xls

When I have uploaded my test file, it shows up with "view icon" in View column, "willie_test.xls" in File Name column, "excel 2003 file to view" in Description column and "r|w|a" in Rights column.

When I copied the test xls file onto a directory on the server and point the URL to the file, I get a "File Download" dialog window with 'open', 'save' and 'cancel' buttons. So, download function works fine as I stated before but not "View" function. It's really weird. And I don't understand Stephen's direction about blue status bar.


2008-07-16 05:11:48 PDT
Look at line 66 of view_file.php; there should be four commented lines that print out the realname, prefix, suffix and mimetype. You might try uncommenting those lines and seeing what the output says. You should end up with something like:

Realname is test.xls
prefix = test
suffix = xls

I wonder if there is something in your /etc/mime.types file that is causing it to not parse properly?

2008-07-17 09:54:59 PDT
I have uncommented the lines, and I get the following:

Realname is willie_test.xls
prefix = willie_test
suffix = xls

I have also tried with a word document, and here is the result:

Realname is testword.doc
prefix = testword
suffix = doc

So, the mimetype is not getting set at all as it was from the URL. What should I look for in mime.types file that could cause it the parse error? Also, we are using a secure(HTTPS) site. Does that affect this somehow?


2008-07-17 10:22:20 PDT
HTTPS will not effect this....

Double check permissions:

drwxr-xr-x 25 root root 4096 Mar 9 14:05 /
drwxr-xr-x 83 root root 8192 Jul 10 12:25 /etc
-rw-r--r-- 1 root root 12727 Jun 13 2007 /etc/mime.types

The line within mime.types says:


Have you applied patch 1720773 ? or 1814598 ? You might look at the other patches for applicability. You could also add some debug print statements to the top of mimetypes.php to see how the lines are getting parsed.

2008-07-21 15:30:57 PDT
I applied both patches that you suggested. The debug message shows the mimetype correctly:

Realname is willie_test.xls
prefix = willie_test
suffix = xls

Now however when I click on the "Click Here" link for viewing, I get "Do you wan to open or save this file?" dialog. And when I click on the 'Open' button, I get "Microsoft Office Excel cannot acces the file..." message. Clicking on 'Download' button works fine as before. Any idea?

2008-07-22 05:51:28 PDT
Sorry... No idea. I don't use Windows, IE, or Microsoft Excel. Could there be security settings on your machine that prevent this? This must be a common enough problem that two different options were incorporated into ODM for file download.