i'm using official this script to upload the file. but response returns ERROR:- Filename cannot be blank
I have changed just parameters in script nothing else as they said. such as
$networkid = "RA";
$apikey = "XXXX";
$offerid = "2207";
$creativetype = "file";
$filename = "JetSmartShopping.zip";
Response from script
Array (
[request] => Array (
[Target] => OfferFile [Format] => json
[Service] => HasOffers
[Version] => 3
[Method] => create
[NetworkToken] => XXXX
[NetworkId] => RA
[data] => Array (
[offer_id] => 2207
[type] => file
[display] => JetSmartShopping.zip
)
[return_object] => 1
[JetSmartShopping_zip] => @JetSmartShopping.zip
)
[response] => Array (
[status] => -1
[httpStatus] => 200
[data] =>
[errors] => Array (
[0] => Array (
[err_code] => 1
[err_msg] => Filename cannot be blank.
[attribute_name] => filename [publicMessage] => Could not create offer file.
)
)
[errorMessage] => Could not create offer file.
)
)
But if i use curl-command then it works
curl --verbose --globoff -X POST -F "xyz.zip=@xyz.zip" "http://api.hasoffers.com/v3/OfferFile.json?Method=create&NetworkToken=XXXX&NetworkId=RA&data[offer_id]=1899&data[type]=file&data[display]=xyz.zip&return_object=1"
I have checked some following requirements for this script
File to be uploaded should be in same path where script resides.
Tried some couple of other solutions from stackoverflow.
Given different name to file
But none of them worked for this script.
But the same file is getting upload using command and using their website.
Any one can figure it out. Thanks in advance.