The following part of the curl request means post a parameter named test.jpg which references a local file path within the current directory called test.jpg.
test.jpg=@test.jpg
If you're using c#, you may want to take a look at the open source library available from facebooksdk.net (note, it's not produced by Facebook):
http://facebooksdk.net/docs/making-synchronous-requests/
Using this, it will likely be a couple of lines of code:
var fb = new FacebookClient("access_token");
string attachementPath = @"C:\\image.jpg";
dynamic result = fb.Post("act_YOURACCOUNTID/adimages",
new
{
file = new FacebookMediaObject
{
ContentType = "image/jpeg",
FileName = Path.GetFileName(attachementPath)
}.SetValue(File.ReadAllBytes(attachementPath))
}
);
As you also tagged PHP, you can use the Facebook SDK which is produced by Facebook with the following code: https://github.com/facebook/facebook-php-sdk/
$facebook = new Facebook(array(
'appId' => 'YOUR_APPID',
'secret' => 'YOUR_APPSECRET',
));
$facebook->setAccessToken("YOUR_ACCESS_TOKEN");
$facebook->setFileUploadSupport(true);
$file='./test.jpg';
$args = array(
basename($file) => '@' . realpath($file),
);
$response = $facebook->api('/act_YOURACTID/adimages','post',$args);