I'm trying to upload an inventory file to Amazon using Curl. I am able to log into my account and onto the inventory upload page but cannot seem to set the correct path since each time the file is uploaded, it indicates Number of records processed from this upload - Zero. I think I have the path wrong. I am using "@/home/path-to-file/file-name.txt" what am I doing wrong? the upload is successful but the system cannot seem to locate the file.
<?php
$URL = 'https://sellercentral.amazon.com/gp/item-manager/ezdpc/uploadInventory.html/ref=ag_invfile_mmap_home';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$page = curl_exec($ch);
$postFields['uploadType'] = 'PriceAndQty';
$postFields['uploadFileName'] = '@/home/path_to_file/inventory_file.txt';
$post = '';
foreach($postFields as $key => $value) {
$post .= $key . '=' . urlencode($value) . '&';
}
$post = substr($post, 0, -1);
curl_setopt($ch, CURLOPT_REFERER, $URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$page = curl_exec($ch); // make request