Topic: chunks not combining

Hi,

I'm uploading and all the chunks are saving as seperate files.

e.g. filename_1.ext
filename_2.ext

etc

config and php code here: http://pastebin.ca/1961781


Anyone any idea why they aren't combining, I'm totally stuck, any pointers would be gratefully received. Am I misunderstanding chunking?

Cheers,

TW

Re: chunks not combining

Anyone got any ideas at all?

Admins? I'm presuming that chunks should just recombine is  this what this stuff is about?

while($in){
fwrite(...
}

TW

Re: chunks not combining

OK, the issue lies in this chunk of code, for each chunk it creates a new file so then the recombining later on doesn't have the right filename so yu end up with each chunk being a sequential file.
file_1.ext
file_2.ext etc.

I can't believe this is supposed to happen, have I missed somethign really obvious here. Some config thing I should have set or something?
If I coment out the code below then it works fine but of course has no protection against duplicate filenames.
   
// make sure filename is unique
if (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
        $ext = strrpos($fileName, '.');
        $fileName_a = substr($fileName, 0, $ext);
        $fileName_b = substr($fileName, $ext);

        $count = 1;
        while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
            $count++;

            $fileName = $fileName_a . '_' . $count . $fileName_b;
        }

Re: chunks not combining

use this

// Make sure the fileName is unique but only if chunking is disabled
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
            $ext = strrpos($fileName, '.');
            $fileName_a = substr($fileName, 0, $ext);
            $fileName_b = substr($fileName, $ext);
   
            $count = 1;
            while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
                $count++;
   
            $fileName = $fileName_a . '_' . $count . $fileName_b;
        }

spocke the admin actually patched the upload.php file.

the above code make sure if the chunking is disabled then only it will create a unique file name.

regards

Jas

Re: chunks not combining

thanks, should have been able to work that out for myself!

Long week.

Re: chunks not combining

With that patch, if I upload a file called "testing.jpg", then I upload another file called "testing.jpg" that requires chunking, the original file will be incorrectly overwritten.  Right?

It seems to me that chunks need to be stored in a temporary directory before being reassembled and moved to the target directory.