// checks if the destination directory is writeable, and attempt to make it writeable
$hash = md5($this->file_dst_name_body . rand(1, 1000));
if ($this->processed && !($f = @fopen($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext, 'a+'))) {
if ($this->dir_auto_chmod) {
$this->log .= '- ' . $this->file_dst_path . ' is not writeable. Attempting chmod:';
if (!@chmod($this->file_dst_path, $this->dir_chmod)) {
$this->log .= ' failed<br />';
$this->processed = false;
$this->error = $this->translate('destination_dir_write');
} else {
$this->log .= ' success<br />';
if (!($f = @fopen($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext, 'a+'))) { // we re-check
$this->processed = false;
$this->error = $this->translate('destination_dir_write');
} else {
@fclose($f);
}
}
} else {
$this->processed = false;
$this->error = $this->translate('destination_path_write');
}
} else {
if ($this->processed) @fclose($f);
@unlink($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext);
}