Skip to main content
Published: March 14 2012, 12:18:00 PMUpdated: November 28 2020, 10:21:33 PM

I am trying to call Upload File with a valid TaskRefeenceId and FileReferenceId, But the server throws an error saying "Invalid File Attachment". I checked my attachment , and the attachment I am sending to eBay is valid. What am i missing here?

The Error "Invalid File Attachment" is returned not just when you upload an invalid/null attachment, but also when the UUID of the Attachment in the uploadFileRequest doesn't match with the UUID sent along with the attachment.

Take this example; I will be printing the actual request sent to clearly distinguish the error.

My request that throws an error is as below:

 

 

Incorrect Request

POST /lms/echo.php HTTP/1.1
Host: localhost:8082
Accept: */*
X-Ebay-Soa-Request-Data-Format: XML
X-Ebay-Soa-Response-Data-Format: XML
X-Ebay-Soa-Security-Token: Your-Token

X-Ebay-Soa-Operation-Name: uploadFile
X-Ebay-Soa-Service-Name: FileTransferService
Content-Length: 27228
Expect: 100-continue


------------------------------e4b5e1ac668d
Content-Disposition: form-data; name="uploadFileRequest.xml"; filename="C:/xampp/htdocs/lms/application/UploadFile/uploadFileRequest.xml"
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:4A515E9048570>

<uploadFileRequest xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services"><taskReferenceId>50002268550</taskReferenceId><fileReferenceId>50002404690</fileReferenceId><fileFormat>gzip</fileFormat><fileAttachment><Size>1235121</Size><Data><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:urn:uuid:4A51606E0C0D1" /></Data></fileAttachment></uploadFileRequest>
------------------------------e4b5e1ac668d
Content-Disposition: form-data; name="BulkDataExchangeRequest.xml"; filename="C:/xampp/htdocs/lms/application/UploadFile/AddFixedPriceItemExample.gz"
Content-Type: application/octet-stream;
Content-Transfer-Encoding: binary
Content-ID: <1.urn:uuid:4A51606E0C0D1>

This will throw an error because the UUID for the attachment does not match with the attachment's Content-ID you sent. Please find the UUID in red, and note that cid: is not a part of UUID.

The correct request should be

Correct Request

------------------------------e4b5e1ac668d
Content-Disposition: form-data; name="uploadFileRequest.xml"; filename="C:/xampp/htdocs/lms/application/UploadFile/uploadFileRequest.xml"
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:4A515E9048570>

<uploadFileRequest xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services"><taskReferenceId>50002268550</taskReferenceId><fileReferenceId>50002404690</fileReferenceId><fileFormat>gzip</fileFormat><fileAttachment><Size>1235121</Size><Data><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="
cid:urn:uuid:4A51606E0C0D1" /></Data></fileAttachment></uploadFileRequest>
------------------------------e4b5e1ac668d
Content-Disposition: form-data; name="BulkDataExchangeRequest.xml"; filename="C:/xampp/htdocs/lms/application/UploadFile/AddFixedPriceItemExample.gz"
Content-Type: application/octet-stream;
Content-Transfer-Encoding: binary
Content-ID:
<urn:uuid:4A51606E0C0D1>

This is important because, Most of the times users build the requests programmatically.

Note: Please note that this applies to the request's UUID as well. If the Request's UUID doesn't match with the request's content ID , the UploadFileRequest will not go through at all.

How well did this answer your question?
Answers others found helpful