-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] File_url parameter is optional but it says mandatory field. #53
Comments
@Abhishekranjan56 Which version are you using? |
I am using "frappe-js-sdk": "^1.4.3", and if I am not passing the file_name it doesnot matter it still shows same error. |
Can you clear your node modules and .lock file and install all the dependencies again? I am not able to reproduce it on our end. We were facing some issues earlier, but that was fixed in v1.4.3 |
Sure |
Done that but same error still persist. Is file_url prop is mandatory?? |
This is the sample of file object I am sending :- |
Oh okay. I didn't know you were using Expo (RN). I haven't tried it on Expo myself, but I know Hussain has an example of a file upload function in doppio_mobile. You won't be able to use the inbuilt function here for raw file uploads but we plan on adding support for that in frappe-JS-SDK and frappe-react-SDK |
In my case, I use this code in my React Native and this error resolved
|
When Up Uploading a file from local storage it shows file_url is mandatory.
The Error logged :-
{"_server_messages": "["{\"message\": \"Fields
file_name
orfile_url
must be set for File\", \"title\": \"Message\", \"indicator\": \"red\", \"raise_exception\": 1, \"__frappe_exc_id\": \"edfbf39cb7c6aa07fd6c67fcbaadbc703635505b7b87ff1571247742\"}"]", "exc_type": "MandatoryError", "exception": "", "httpStatus": 417, "httpStatusText": undefined, "message": "There was an error while uploading the file."}fileName>>>>> 820b6003-d080-4e81-ac44-afcc909aaf96.png
Payload :- const fileArgs = {
isPrivate: true,
folder: "Home",
file_name: fileName,
doctype: "User",
docname: "sub doc type",
fieldname: "user_image"
};
file
.uploadFile(myFile, fileArgs, (completedBytes, totalBytes) =>
console.log(Math.round((completedBytes / totalBytes) * 100), " completed")
)
.then((r) => console.log(r))
.catch((e) => console.error(e));
The text was updated successfully, but these errors were encountered: