apache : configure to view .DWF file types

Problems with the Windows version of XAMPP, questions, comments, and anything related.

apache : configure to view .DWF file types

Postby gsyntaxerr » 09. June 2004 15:37

hello

I am trying to configure apache so that it is able to correctly record and display files of the .dwf format embedded in Internet Explorer. Just like one would be able to view .pdfs within a browser. However I am still unable to get this done. Any ideas? Thanks.

This is what I am doing:

per: http://usa.autodesk.com/adsk/servlet/ps ... ID=2496562

here's the entry in my apache conf file:
AddType application/x-dwf .dwf

as per:
http://httpd.apache.org/docs-2.0/en/mod ... ml#addtype

Thanks.
g
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Postby micha78347 » 09. June 2004 15:51

test

i dont know something about Autodesk modules, but

you have to use:

1)

AddType application/x-dwf .dwf
Action application/x-dwf "/path_to_volo/volo.exe"

2) OR something like this:

AddType application/x-dwf .dwf
LoadFile "/path_to_volo/volo.dll"
OR
AddType application/x-dwf .dwf
Loadmodule "/path_to_volo/volo.dll"
micha78347
 
Posts: 57
Joined: 07. June 2004 20:56

Re: apache : configure to view .DWF file types

Postby Wiedmann » 09. June 2004 16:32

gsyntaxerr wrote:I am trying to configure apache so that it is able to correctly record and display files of the .dwf format embedded in Internet Explorer.


How did you embed the drawing?

Did you use a code like this?
Code: Select all
<object classid="clsid:8718C658-8956-11D2-BD21-0060B0A12A50" width="640" height="480">
   <param name="src" value="name_of_file.dwf">
   <embed width="640" height="480" src="name_of_file.dwf">
   </embed>
</object>
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: apache : configure to view .DWF file types

Postby micha78347 » 09. June 2004 16:46

Wiedmann wrote:
gsyntaxerr wrote:I am trying to configure apache so that it is able to correctly record and display files of the .dwf format embedded in Internet Explorer.


How did you embed the drawing?

Did you use a code like this?
Code: Select all
<object classid="clsid:8718C658-8956-11D2-BD21-0060B0A12A50" width="640" height="480">
   <param name="src" value="name_of_file.dwf">
   <embed width="640" height="480" src="name_of_file.dwf">
   </embed>
</object>


Wiedmann, is this the solution for adding new exotic MIMEtypes to apache server ? , well i didnt know that..
micha78347
 
Posts: 57
Joined: 07. June 2004 20:56

Postby gsyntaxerr » 09. June 2004 20:11

i have my apache configured to read the mime type .dwf see below using the AddType Directive:

here's a snippet of my file:

AddType image/vnd.dxf .dxf
AddDescription "AutoCAD" .dxf
AddType image/vnd.dwg .dwg
AddDescription "AutoCAD map" .dwg
AddType drawing/x-dwf .dwf
AddDescription "AutoCAD drawing web format" .dwf

However when I look at the source of my php file this is what i see:

</td>
<td nowrap="8%">
<a href="./fileviewer.php?file_id=8" title="">Howe Res A Pump Plan 1-Layout1.dwf</a> </td>
<td width="20%"></td>
<td width="5%" nowrap="nowrap" align="center">1</td>
<td width="15%" nowrap="nowrap">Greg Griffith</td>
<td width="10%" nowrap="nowrap" align="right">65 kb</td>
<td width="15%" nowrap="nowrap">Model/vnd.dwf</td>
<td width="15%" nowrap="nowrap" align="right">06/09/2004 10:30 am</td>


What I get from this is the server still is not interpreting .dwf in the correct manner.
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Postby Wiedmann » 09. June 2004 20:26

gsyntaxerr wrote:...
<a href="./fileviewer.php?file_id=8" title="">Howe Res A Pump Plan 1-Layout1.dwf</a>
...
What I get from this is the server still is not interpreting .dwf in the correct manner.

What happens in the file "fileviewer.php" with the parameter "file_id=8"?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby gsyntaxerr » 09. June 2004 20:49

Basically the server looks for a file with that id number and then tries to serve it up in the correspoding application based on the file extension:

for example look at the code:

<td nowrap="8%">
<a href="./fileviewer.php?file_id=23" title="">Howe Pit Design Details_Vector2004.pdf</a> </td>
<td width="20%"></td>
<td width="5%" nowrap="nowrap" align="center">1</td>
<td width="15%" nowrap="nowrap">Greg Griffith</td>
<td width="10%" nowrap="nowrap" align="right">536 kb</td>
<td width="15%" nowrap="nowrap">application/pdf</td>

here the server looks for a file with id-23 knows that tis a .pdf and uses the mime type config in apache to load the pdf:

ie: "application/pdf"

Notice when it tries to serve the .dwf the mime type is still being reported as <td width="15%" nowrap="nowrap">Model/vnd.dwf</td> and not as drawing/x-dwf as suggested by autodesk.

g
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Postby Wiedmann » 09. June 2004 20:58

<td nowrap="8%">
<a href="./fileviewer.php?file_id=23" title="">Howe Pit Design Details_Vector2004.pdf</a> </td>
<td width="20%"></td>
<td width="5%" nowrap="nowrap" align="center">1</td>
<td width="15%" nowrap="nowrap">Greg Griffith</td>
<td width="10%" nowrap="nowrap" align="right">536 kb</td>
<td width="15%" nowrap="nowrap">application/pdf</td>

here the server looks for a file with id-23 knows that tis a .pdf and uses the mime type config in apache to load the pdf:

No. This ia a simple table with some text and one link:
<a href="./fileviewer.php?file_id=23" title="">

And now: What happens if an user click on the link. He browse to the file "fileviewer.php" with the parameter "file_id=23". So, what's the code inside "fileviewer.php".?

What happes if you open the file in the browser with:
"http://localhost/name_of_file.dwf"

(Remember, VoloView must installed correctly at the user PC)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

MIME

Postby gsyntaxerr » 09. June 2004 22:39

here's the code for fileviewer pgp if it means anything:

<?php /* $Id: fileviewer.php,v 1.18 2003/09/19 04:50:29 ajdonnison Exp $ */
//file viewer
require "./includes/config.php";
require "./classes/ui.class.php";

session_name( 'dotproject' );
if (get_cfg_var( 'session.auto_start' ) > 0) {
session_write_close();
}
session_start();
$AppUI =& $_SESSION['AppUI'];

require "{$AppUI->cfg['root_dir']}/includes/db_connect.php";

include "{$AppUI->cfg['root_dir']}/includes/main_functions.php";
include "{$AppUI->cfg['root_dir']}/includes/permissions.php";

$canRead = !getDenyRead( 'files' );
if (!$canRead) {
$AppUI->redirect( "m=public&a=access_denied" );
}

$file_id = isset($_GET['file_id']) ? $_GET['file_id'] : 0;

if ($file_id) {
// projects that are denied access
$sql = "
SELECT project_id
FROM projects, permissions
WHERE permission_user = $AppUI->user_id
AND permission_grant_on = 'projects'
AND permission_item = project_id
AND permission_value = 0
";
$deny1 = db_loadColumn( $sql );

$sql = "SELECT *
FROM permissions, files
WHERE file_id=$file_id
AND permission_user = $AppUI->user_id
AND permission_value <> 0
AND (
(permission_grant_on = 'all')
OR (permission_grant_on = 'projects' AND permission_item = -1)
OR (permission_grant_on = 'projects' AND permission_item = file_project)
)"
.(count( $deny1 ) > 0 ? "\nAND file_project NOT IN (" . implode( ',', $deny1 ) . ')' : '');

if (!db_loadHash( $sql, $file )) {
$AppUI->redirect( "m=public&a=access_denied" );
};

// BEGIN extra headers to resolve IE caching bug (JRP 9 Feb 2003)
// [http://bugs.php.net/bug.php?id=16173]
header("Pragma: ");
header("Cache-Control: ");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); //HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
// END extra headers to resolve IE caching bug

header("MIME-Version: 1.0");
header( "Content-length: {$file['file_size']}" );
header( "Content-type: {$file['file_type']}" );
header( "Content-disposition: inline; filename={$file['file_name']}" );
readfile( "{$AppUI->cfg['root_dir']}/files/{$file['file_project']}/{$file['file_real_filename']}" );
} else {
$AppUI->setMsg( "fileIdError", UI_MSG_ERROR );
$AppUI->redirect();
}
?>
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Postby Wiedmann » 09. June 2004 23:56

Notice when it tries to serve the .dwf the mime type is still being reported as <td width="15%" nowrap="nowrap">Model/vnd.dwf</td> and not as drawing/x-dwf as suggested by autodesk.

But, the Content-type (mime type) ist set through PHP and not Apache and is stored in the database:
header( "Content-type: {$file['file_type']}" );

$file[] is the result of a sql query. Is there an error in the database?

Can you make this test:
Wiedmann wrote:What happes if you open a dwf file in the browser with:
"http://localhost/name_of_file.dwf"
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby gsyntaxerr » 10. June 2004 00:07

Umm the file opens just fine within IE :)
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Postby Wiedmann » 10. June 2004 00:40

gsyntaxerr wrote:Umm the file opens just fine within IE :)

Fine :-)

Can you verify the values for this file in the database with phpMyAdmin? I think there is a column file_id and file_type. In the row with file_id=8, what is the value in file_type?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby gsyntaxerr » 10. June 2004 00:53

the file_type is Model/vnd.dwf
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Postby Wiedmann » 10. June 2004 01:05

gsyntaxerr wrote:the file_type is Model/vnd.dwf

Can you change this with phpmyAdmin in "drawing/x-dwf"? Are the other values for this file correct in the database?

What happens if you use your script now?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby gsyntaxerr » 10. June 2004 01:20

So i change the file type within the db table to the type you suggested ie: from Model/vnd.dwf to drawing/x-dwf but i get the same error and the file_type entry for that specfic file returns to its original Model/vnd.dwf

All other file types function correctly ie: .jpgs .docs .pdfs
and have their associated entries in the table file_type correctly set ie:
image/jpg
application/msword
application/pdf


Ok I just edited the registry HKEY_CLASSES_ROOT entry for .DWFs [and hcanged it from its orignal Model/vnd.dwf to drawing/x-dwf ].

Now the file_type shows up correctly in the db table and doesnt go back to its orignal Model/vnd.dwf but the error still persists when I try to run the script.
Last edited by gsyntaxerr on 10. June 2004 01:53, edited 1 time in total.
"The imaginary friends I had as a kid dropped me because their friends thought I didn't exist."
gsyntaxerr
 
Posts: 12
Joined: 23. April 2004 21:57
Location: a mile high, denver CO, usa

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests