Two options:
- First upload file completely, then chmod it.
- Create empty file, chmod it, then put your data into it.
Doing a chmod on a file is rather simple in PHP:
chmod("/directory/file", 0755);
Just remember that you need to use octal and not decimal to get the correct value of mode; so prepend your "755" with a "0" as shown in the example above!
For your code, I would do it like this:
public function receive()
{
...
chmod($this->path . $this->fileName, 0755);
return true;
}
More details related to the CHMOD command in php can be found at http://php.net/manual/de/function.chmod.php.