&& $file->getContent() != $arFile['content']
)
) {
+ $dir = dirname($file->getFullPath());
+ if (!is_dir($dir)) {
+ mkdir($dir, 0777, true);
+ }
file_put_contents($file->getFullPath(), $arFile['content']);
$command = $vc->getCommand('add')
->addArgument($file->getFilename())
if ($_FILES['files']['error'][$num]['upload'] == 0) {
return true;
}
- if ($arFile['content'] != '') {
+ if (isset($arFile['content']) && $arFile['content'] != '') {
+ return true;
+ }
+ if (isset($arFile['name']) && $arFile['name'] != '') {
+ //binary files do not have content
+ return true;
+ }
+ if (isset($arFile['delete']) && $arFile['delete'] != '') {
+ //binary files do not have content
return true;
}
}
return $prefix . $num;
}
- protected function getType($content)
+ public function getType($content)
{
$tmp = tempnam(sys_get_temp_dir(), 'phorkie-autodetect-');
file_put_contents($tmp, $content);