Re: Splitting uploads up/ concatenating them back together
- From: "nwheavyw8@xxxxxxxxx" <nwheavyw8@xxxxxxxxx>
- Date: 24 Sep 2005 17:11:42 -0700
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?
.
- Follow-Ups:
- Re: Splitting uploads up/ concatenating them back together
- From: Kim André Akerø
- Re: Splitting uploads up/ concatenating them back together
- References:
- Splitting uploads up/ concatenating them back together
- From: nwheavyw8
- Re: Splitting uploads up/ concatenating them back together
- From: Andy Hassall
- Re: Splitting uploads up/ concatenating them back together
- From: nwheavyw8@xxxxxxxxx
- Re: Splitting uploads up/ concatenating them back together
- From: Lāʻie Techie
- Splitting uploads up/ concatenating them back together
- Prev by Date: Including a .php file from another server?
- Next by Date: Re: front for mysql
- Previous by thread: Re: Splitting uploads up/ concatenating them back together
- Next by thread: Re: Splitting uploads up/ concatenating them back together
- Index(es):
Relevant Pages
|