perry-mitchell/webdav-client

409 error for upload

Closed this issue · 1 comments

hi . your library provide method for get upload link based on filename but how i can upload i get error 409 and this is my code
const formData = new FormData();
formData.append('file', this.selectedFile); // Append selected file to the form data
const config = {
auth:{
username:"admin",
password:"admin",
},
headers: {
'Content-Type': 'multipart/form-data'
}
};
try {
const response = await axios.put(
"http://admin:admin@nextcloud_proxy_backend.develop/remote.php/dav/files/admin",
formData,
config
);
console.log('File uploaded successfully:', response);
} catch (error) {
console.error('Error uploading file:', error);
}
can anyone give me help fo this?

Hi. Your code doesn't show how you use this library. Could you please update your example so that it does?

Also, 409 means conflict so the server is complaining due to some state most likely.

Please note that the upload link does not work for every service. It might also work differently for some services. The fact that it exists in this library is merely as a helper to generate such a URL; it does not guarantee that it works.

What WebDAV server do you use?