Parameter 'file' invalid


#1

Hi, I love your service, been running some tests, I want to use the API by uploading a local image (electron app). I’ve created an apikey and use it, it works well with url but not with files, I get this message: “Parameter name ‘file’ is invalid. Valid parameters: apikey,url,language,isoverlayrequired,base64image,iscreatesearchablepdf,issearchablepdfhidetextlayer,filetype”
(my file is much smaller than 1MB) can you please tell me what am I doing wrong?


#2

If you test the connection with Postman, do you get the same result?

You probably know it, but just in case: Postman is a free Chrome app, see https://ocr.space/ocrapi#postman

If you see the problem even with Postman, a screenshot of the result could be helpful.

The open-source Copyfish Chrome and Firefox extension uses our OCR API with the file upload parameter. You find its Javascript source code here. Here is the line that calls the api: https://github.com/A9T9/Copyfish/blob/1cbce8558c63c55cf79223cf741757835510fe78/scripts/cs.js#L473

	function _postToOCR($ocrPromise, postData, attempt) {
		var formData = new FormData();
		formData.append('language', postData.language);
		formData.append('file', postData.blob, postData.fileName);
		if (OPTIONS.visualCopyTextOverlay) {
			formData.append('isOverlayRequired', true);
		}