PHP :: FTP更改文件权限

Im doing php pipe email functionality i am able to upload file from email and i am uploading file(jpg,png..) in my folder.

problem is when access that file from FTP or Browser that file not opening. and uploaded files permissions code default showing 600 and "-rw----" and owner/group showing 99 99.

i need to change permissions to 644 and 502 100. in my script i used:

chmod("/var/www/html/quantumcrew/blogpdf/",0777);  

how can i change owner permissions from my script(mail pipe script).

To change ownership you would need to use chown. http://php.net/manual/en/function.chown.php

chown("/var/www/html/quantumcrew/blogpdf/", 502);