- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
protected function ___install($filename) {
$basename = $this->pagefiles->cleanBasename($filename, true, false, true);
$pathInfo = pathinfo($basename);
$basename = basename($basename, ".$pathInfo[extension]");
$basenameNoExt = $basename;
$basename .= ".$pathInfo[extension]";
// ensure filename is unique
$cnt = 0;
while(file_exists($this->pagefiles->path() . $basename)) {
$cnt++;
$basename = "$basenameNoExt-$cnt.$pathInfo[extension]";
}
if(strpos($filename, ' ') !== false && strpos($filename, '://') !== false) $filename = str_replace(' ', '%20', trim($filename)); // per Pete
$destination = $this->pagefiles->path() . $basename;
if(!@copy($filename, $destination)) throw new WireException("Unable to copy: $filename => $destination");
if($this->config->chmodFile) chmod($this->pagefiles->path() . $basename, octdec($this->config->chmodFile));
$this->changed('file');
parent::set('basename', $basename);
}
bormand 26.10.2020 16:05 # +1
Saehrimnir 26.10.2020 16:06 # 0
bormand 26.10.2020 16:07 # 0
guest8 26.10.2020 16:07 # −999
WGH 26.10.2020 16:07 # 0
CHayT 26.10.2020 16:08 # 0
guest8 26.10.2020 16:08 # −999
CHayT 26.10.2020 16:09 # 0