You are here: Re: Splitting uploads up/ concatenating them back together « PHP Programming Language « IT news, forums, messages
Re: Splitting uploads up/ concatenating them back together

Posted by nwheavyw8@gmail.com on 09/25/05 03:11

okay, my downloader script looks like this:

<?php

// Set some values

$file = &$_GET['file'];
$nomore = 0;
$count = 1;
$size = 0;

// Get MIME type

$handle = fopen($file.'/fmime', "r");
$mime = file_get_contents($handle);
fclose(handle);

// Get file name

$handle = fopen($file.'/fname', "r");
$name = file_get_contents($handle);
fclose(handle);

// Get size of file

while ($nomore = 0):
if (file_exists($file.'/'.$count)):
$size .= $size + filesize($file.'/'.$count);
else:
$nomore = 1;
endif;
endwhile;


// Reset values

$nomore = 0;
$count = 1;

// Concatenate file

header("Content-length: $size"); //$size is the size of $content in
bytes
header("Content-type: $mime");
header("Content-Disposition: attachment; filename=$name"); //whatever
name you want to give the file
while ($nomore = 0):
if (file_exists($file.'/'.$count)):
$handle = fopen($file.'/'.$count, "rb");
$content = file_get_contents($handle);
echo $content;
fclose($handle);
else:
$nomore = 1;
endif;
endwhile;

and I uploaded a little test file (already splitted and stuff), but
when I try to download it, i get these errors:


Warning: file_get_contents() expects parameter 1 to be string, resource
given in /home/freehost/t35.com/l/i/lildude/downloader.php on line 13

Warning: fclose(): supplied argument is not a valid stream resource in
/home/freehost/t35.com/l/i/lildude/downloader.php on line 14

Warning: file_get_contents() expects parameter 1 to be string, resource
given in /home/freehost/t35.com/l/i/lildude/downloader.php on line 19

Warning: fclose(): supplied argument is not a valid stream resource in
/home/freehost/t35.com/l/i/lildude/downloader.php on line 20

Warning: Cannot modify header information - headers already sent by
(output started at
/home/freehost/t35.com/l/i/lildude/downloader.php:13) in
/home/freehost/t35.com/l/i/lildude/downloader.php on line 40

Warning: Cannot modify header information - headers already sent by
(output started at
/home/freehost/t35.com/l/i/lildude/downloader.php:13) in
/home/freehost/t35.com/l/i/lildude/downloader.php on line 41

Warning: Cannot modify header information - headers already sent by
(output started at
/home/freehost/t35.com/l/i/lildude/downloader.php:13) in
/home/freehost/t35.com/l/i/lildude/downloader.php on line 42

what am I doing wrong?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация