Can't upload image using curl

You seem to create an array called $postimg but never use it, and use a variable called $postdata which you don’t show being initialised. Is that correct? Wouldn’t explain why it works on one server but not the other, though.