ok so this might be better in the PHP section because it has to do with my php scripts trying to write files to directories.

My FTP account (and major user account) is piagency. All my files and folders in my /var/www/ is set to piagency as owner and of the www-data group

the user account piagency is part of the www-data group

my php script first creates a directory (if it doesnt exist) then uploads the file to that folder.....or is supposed to.

PHP Code:
mkdir("/uploads/" $_REQUEST['clientID'] . '/video/'0777); 
PHP Code:
move_uploaded_file($_FILES['vidfile']['tmp_name'], $filename
I get mkdir(): No such file or directory

and

failed to open stream: No such file or directory

Weird thing is that i cant delete the video folder and try again. Filezilla says folder is not empty

But it will create the folder

and it will upload the smaller file (there are actually 2 files that get uploaded to same folder)

but the folder says its owner is www-data and group www-data.

But from FTP i cant delete it.

Any ideas?