Forums | Mahara Community

Support /
Artefact type of zip files seem to be wrong


Howard Miller's profile picture
Posts: 116

23 July 2013, 2:42 AM

Mahara 1.6...

On my production site, uploaded zip files cannot be unzipped. On my test site they can. Checking the database entries I can see that on the test site the 'artefacttype' field is 'archive' and on the production site 'file' for exactly the same file.

Production site:

id: 158342
artefacttype: file
container: 0
parent: NULL
owner: 1
institution: NULL
group: NULL
ctime: 2013-07-22 14:51:43
mtime: 2013-07-22 14:51:43
atime: 2013-07-22 14:51:43
locked: 0
title: FastSpring.zip
description: NULL
note: NULL
author: 1
authorname: NULL
allowcomments: 0
approvecomments: 0

 

Test site:

id: 9
artefacttype: archive
container: 0
parent: NULL
owner: 1
institution: NULL
group: NULL
ctime: 2013-07-22 14:50:44
mtime: 2013-07-22 14:50:44
atime: 2013-07-22 14:50:44
locked: 0
title: FastSpring.zip
description: NULL
note: NULL
author: 1
authorname: NULL
allowcomments: 0
approvecomments: 0

Any idea why?



Aaron Wells's profile picture
Posts: 896

23 July 2013, 2:36 PM

When you upload a file, the file type that Mahara applies to it is based on:

1) The Mime Type that your browser thought the file was when it uploaded it, which means it can vary depending on what browser you were using

2) Or, if the browser provided no guess or described the file as "application/octet-stream", then Mahara falls back to using various PHP methods to make a best guess about the file type. These may vary depending on which server PHP is running on.

The logic for this is in htdocs/artefact/file/lib.php, ArtefactTypeFile::new_file() and htdocs/lib/file.php, function file_mime_type().

In particular, check if the PHP fileinfo library is installed on your prod site and your testing site. http://nz1.php.net/manual/en/fileinfo.installation.php

Cheers,

Aaron

2 results