Loading...
 
Development

Development


error in downloading files

posts: 8

Problem in File Galleries:Ttiki uploads .doc and .xls files successfully, but whei i try to download it, the russian filename is corrupted, and content of file completely destroyed - there're just meny unrecognizable symbols. But, Tiki shows correct fuilename in listing gallery, and size of normal file same as size of corrupted file.

On server files are stored safe - when i found smth like 8b845bae6d5060f14f535404ae4a904f, add a ".doc" extention adn file opens OK.
So problem arises when I download. I think is't troubles with encodeng, but i don't know exactly what happens and what to do...

HELP ME SOMEBODY!!!!!!!!!!!!!

Apache/2.0.45 (Win32)
PHP Version 4.3.2
MySQL 4.1.1.2 (on older versions rezults are the same)
Language of files and filenames is russian.

posts: 2881 United Kingdom

MySQL 4.1 is only supported in the latest BRANCH-1-9 tikiwiki, grab the latest code and try again.

Probably Apache needs configuring to send the filenames as UTF-8

Damian
http://tikihost.net

posts: 8

1.MySql
Downloaded tiki 1.9, problem is the same. By the way, the same thing happens to forum attaches if they are .doc or .xls files. and it doesn't depend on the
PHP version (tried php 4.3 and php 5.0.1) or mysql ver (tried 4.0 and 4.1, and earlier, smth like 3.3.2... - don't remember).
Default Mysql encoding is UTF-8.

2.Apache
When I try to download file from apache directly, e.g. not through TIKI, it's OK.
(Outgoing .doc encoded in win1251. May be is considers that doc is stored encoded in UTF-8?)

???????.doc > ?°???‚???±???‚.doc

File is being corrupted smw between calling tiki-download.php and starting http download from apache, because apache peforms OK and files on server stored in files named like 8b845bae6d5060f14f535404ae4a904f are safe.

what happens there?
tiki takes file, decodes it, and writes it to a tmp dir, from where apache start http download... so, trouble id in decoding proc. Right, Damian?

Another question - why it corrupts filename. Filename shown correctly on another tiki pages.

what you think, guys?





> MySQL 4.1 is only supported in the latest BRANCH-1-9 tikiwiki, grab the latest code and try again.
>
> Probably Apache needs configuring to send the filenames as UTF-8
>
> Damian
> http://tikihost.net
>

posts: 2881 United Kingdom

> 1.MySql
> Downloaded tiki 1.9, problem is the same. By the way, the same thing happens to forum attaches if they are .doc or .xls files. and it doesn't depend on the
> PHP version (tried php 4.3 and php 5.0.1) or mysql ver (tried 4.0 and 4.1, and earlier, smth like 3.3.2... - don't remember).
> Default Mysql encoding is UTF-8.

1.9.0 from SourceForge doesnt work with 4.1, only CVS BRANCH-1-9 code works i.e. the tar.gz from de.tikiwiki.org


> File is being corrupted smw between calling tiki-download.php and starting http download from apache, because apache peforms OK and files on server stored in files named like 8b845bae6d5060f14f535404ae4a904f are safe.

What encoding is PHP configured to use?

> Another question - why it corrupts filename. Filename shown correctly on another tiki pages.

Its not corrupting them, its making a md5 hash of the file not the filename and then stores the file using that hash as the name. This makes it very hard for someone when stored in the file system to go directly to the download folder and "guess" filenames.

This also means that you cannot upload the same file twice in any gallery.

Damian
http://tikihost.net


posts: 8

Hi, ALL! Hi, Damian!

I'm back to tiki. Problem persists. I've found that it adds 2 bytes (A0 A0) to the beginning of the file - that's why files seem corrupted and cannot be opened by applications (word, excel, acrobat, ppt, etc.). Compression doesn't play any role here.

It's all in function readFile () in the ZLIB.PHP.

What do you think, why it adds these 2 symbols?
ANY IDEAS?????


posts: 8

YYYEEESSSSS!!!!!!!!
Guys, wanna have fun, eh ??? :_)))

problem reason: before start output we have to clear the output buffer. Otherwise, system will also write then output made in files that we include or require (it's spaces after ?> tag in these files).

the result code in tki-download_fiile.php

posts: 8

(sorry, but forum doesn't allow to edit my previous message - BUG??? )

YYYEEESSSSS!!!!!!!!
Guys, wanna have fun, eh ??? :_)))

problem reason: before start output we have to clear the output buffer. Otherwise, system will also write output made in files that we include or require (it's spaces after ?> tag in these files).

the result code in tki-download_fiile.php

require (it's spaces after ?> tag in these files).

i added ob_end_clean function after INCLUDE and REQUIRE statements in tiki-download_file php.

thanks to all!!!
thanks, Damian!