The directory you're uploading to needs to have write permissions set. You can do this via FTP using CHMOD and changing the permissions.
If you're creating directories on the fly when you upload images, you can do something similar to this:
Make dir code example:
CHMOD code example: