brandonsavage / Upload

File uploads with validation and storage strategies
MIT License
1.67k stars 315 forks source link

fix setname bug when uploads multipal files #87

Closed longniao closed 8 years ago

longniao commented 8 years ago

When uploads multipal files, use setName action would rename all files to the same name. so, use the setMultipleNames action with array params will solve the bug.

Example.

// rename the file
$fileCount = $file->count();
if($fileCount > 1){
    $fileNames = array();
    for($i = 0; $i < $fileCount; $i++){
        $fileNames[] = uniqid();
    }
    $file->setMultipleNames($fileNames);
}else{
    $file->setName(uniqid());
}
brandonsavage commented 8 years ago

I agree this is a problem worth fixing, but this isn't my preferred approach to fix it. I'll work on a better solution.