开发者

Read and write tbz file in PHP

Hi I want to download a file that is in tbz format. So I first need to download tbz file so I am first reading it and writing to local directory on my server using the following code:

ini_set("memory_limit","15M");
set_time_limit(1600);

if($result){
$write_handle=fopen("temp/$filename", 'a');
while (!feof($handle)) {
  $contents = fread($handle, 8192);
  echo "<pre>";
  echo strlen($contents);
  echo time()-$time_start;
  echo "</pre>";
  fwrite($write_handle, $contents);
}
echo $contents;
fclose($write_handle);    
}

And the files is there but when I try to tar -xjf command of linux on it, it says : Unexpected EOF in archive. So what can be problem?

I actually need to use the file inside that tbz file so is the开发者_Python百科re a way to do so. File size is almost more than 1GB.


Hmz, you only give a part of your code, but reading your issue and considering you said: File size is almost more than 1GB. I have to ask..

Are you using set_time_limit() so the scripts lasts long enough and memory_limit in php.ini so the script has enough memory?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜