You didn't mention what the errors you get are, but from you message I assume it's something about permissions or being unable to open the file for writing.
If your script doesn't have permission to write to the directory, then your script doesn't have permission to write to the directory. You aren't going to find a php function which can override the security of the system and write files where it isn't allowed. And if you do please report it as a huge security violation to the php devs.
You can try to chmod the directory in php, but I doubt that will do anything for you. Better to contact your webhost and find out how you're supposed to upload files given their security requirements.