In the case of a dynamic upload folder for a file, the default index.html is not checked on each subfolder of the path. it's only checked in the root file field folder.
1st example
field: image
rename filename rule: {BASE}.{EXT}
jcook-component behaviour:
if the "upload_dir_view_image" doesn't exist, it's created and the file index.html is created as well.
Everything is fine here.
2nd example
field: image
rename filename rule: mywhateverfolder/{ID}/{BASE}.{EXT}
jcook-component behaviour:
see behaviour 1st example. nothing changes.
the files are correctly uploaded into the folder: upload_dir_view_image/mywhateverfolder/{ID}/{BASE}.{EXT}
but ONLY the root folder (upload_dir_view_image) will have the index.html
fix:
modify the function process() in the file ROOT\administrator\components\com_component\classes\file\upload.php
public function process()
{
$fileDest = $this->uploadFolder . $this->file->filename;
/* hack */
$basedir = dirname($this->file->filename);
if($basedir != '.'){
$rootUploadFolder = $this->uploadFolder;
while($basedir != '.'){
$this->setUploadFolder($rootUploadFolder . $basedir);
$basedir = dirname($basedir);
}
$this->uploadFolder = $rootUploadFolder;
}
/* hack */
if ( !move_uploaded_file($this->file->tmp, $fileDest))
if(!JFile::upload($this->file->tmp, $fileDest))
return false;
//Protect file against execution
@chmod($fileDest, JSHOP_UPLOAD_CHMOD_FILE);
return true;
}