Re: Splitting uploads up/ concatenating them back together



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?

.



Relevant Pages

  • Re: Splitting uploads up/ concatenating them back together
    ... my downloader script looks like this: ... > Warning: fclose: supplied argument is not a valid stream resource in ... Cannot modify header information - headers already sent by ...
    (comp.lang.php)
  • Re: Bolt-on Bits
    ... like a rev counter and a temperature gauge. ... Warning: readdir: supplied argument is not a valid Directory resource in ... Warning: fclose: supplied argument is not a valid stream resource in ... Cannot modify header information - headers already sent by (output ...
    (uk.rec.waterways)
  • Re: Bolt-on Bits
    ... like a rev counter and a temperature gauge. ... Warning: readdir: supplied argument is not a valid Directory resource in ... Warning: fclose: supplied argument is not a valid stream resource in ... Cannot modify header information - headers already sent by (output ...
    (uk.rec.waterways)
  • Re: PHP [win32] & CLI Testers needed.
    ... written, lets just say to create shell emulation for now, and have ... My previous attempts to create the source below, ended with the loop ... Debug Warning: testforLinuxUser.php line 24 - stream_select: supplied argument is not a valid stream resource ...
    (php.general)
  • Re: PHP [win32] & CLI Testers needed.
    ... written, lets just say to create shell emulation for now, and have ... My previous attempts to create the source below, ended with the loop ... Debug Warning: testforLinuxUser.php line 24 - stream_select: supplied argument is not a valid stream resource ...
    (php.general)