Sure. You can't use cookies, since they can be deleted (thus allowing the user to upload 2*infinite amount of <500kb images). Instead, you'll need user accounts or IP tracking. Don't let any one user/ip upload more than 2 images by storing that they've uploaded, and then incrementing that. I'd recommend using a database like MySQL to store the data.
To check whether or not it's greater than 500kb, you can check the $_FILES["myfile"]["size"] attribute. 1kb = 1024b.