Author Topic: Document area: not able to upload docx files.  (Read 3598 times)

masilon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Document area: not able to upload docx files.
« on: April 12, 2012, 01:34:00 pm »
Hello, I installed Fengoffice community version on a Centos server.

The odd thing is that I'm not able to upload docx file.

Infact, after uploading it, the document area becomes grey and the file is not shown.

But If I change the file extension from docx to for example dotx, the file is uploaded.

Actually I found out that the file is uploaded in tmp directory but it is not moved then into the upload one nor it is writen into the database.

Any idea ?
Thanks
Luca

masilon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Document area: not able to upload docx files.
« Reply #1 on: April 13, 2012, 09:49:52 am »
Solved. It was missing ziparchive class. Updating to php 5.2 solved the problem

svenk87

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Document area: not able to upload docx files.
« Reply #2 on: June 12, 2012, 09:57:33 am »
Hello everybody,

i got exactly the same error:

If i try to upload any docx Files in Document Section i will get an Error 500 Message, but the data is uploaded to the /tmp folder., named like "doc_filecontent_104.docx".

When i change the File-Extension to .doc or something else, the upload works without any problem and i can rename it to .docx after uploading.

unfortunately the solution of masilon, to upgrade to php 5.2 with .zip Extension, wont work for me.

It would be very nice if anybody can help me to get this issue fixed.

svenk87

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Solved: Document area: not able to upload docx files.
« Reply #3 on: June 12, 2012, 10:58:49 am »
I`ve solved the issue at myself now, my personal solution (if anybody got the same issue);

Open: application/models/ApplicationDataObject.class.php

Find (at line 111):
Code: [Select]
try {
if($file->getFileTypeId() == 12){
$file_path = "tmp/doc_filecontent_".$this->getObjectId().".docx";
$file_tmp = @fopen($file_path, 'w');
if ($file_tmp) {
fwrite($file_tmp, $file->getFileContent());
fclose($file_tmp);
$content = docx2text($file_path);
unlink($file_path);
}

}elseif($file->getFileTypeId() == 19){

$file_path = "tmp/pdf_filecontent_".$this->getObjectId().".pdf";
$file_tmp = @fopen($file_path, 'w');
if ($file_tmp) {
fwrite($file_tmp, $file->getFileContent());
fclose($file_tmp);
$content = pdf2text($file_path);
unlink($file_path);
}

}
}


And replace with:
Code: [Select]
try {
if($file->getFileTypeId() == 19){

$file_path = "tmp/pdf_filecontent_".$this->getObjectId().".pdf";
$file_tmp = @fopen($file_path, 'w');
if ($file_tmp) {
fwrite($file_tmp, $file->getFileContent());
fclose($file_tmp);
$content = pdf2text($file_path);
unlink($file_path);
}

}
}



Or optionally comment out the first Block like this:
Code: [Select]
try {
/*
if($file->getFileTypeId() == 12){
$file_path = "tmp/doc_filecontent_".$this->getObjectId().".docx";
$file_tmp = @fopen($file_path, 'w');
if ($file_tmp) {
fwrite($file_tmp, $file->getFileContent());
fclose($file_tmp);
$content = docx2text($file_path);
unlink($file_path);
}

}else */

if($file->getFileTypeId() == 19){

$file_path = "tmp/pdf_filecontent_".$this->getObjectId().".pdf";
$file_tmp = @fopen($file_path, 'w');
if ($file_tmp) {
fwrite($file_tmp, $file->getFileContent());
fclose($file_tmp);
$content = pdf2text($file_path);
unlink($file_path);
}

}
}

This worked for me, now i can upload all filetypes, including docx-files without any Errors.