Top Forums Web Development Sending file to WebDav Server Post 303043525 by Akshay Hegde on Thursday 30th of January 2020 10:40:32 AM
You should now options enabled in your server endpoint, I used in past with nextcloud

Below few are examples, for authentication use -u user:pass

Code:
# to get options supported by your server
# output can be Allow: DELETE,MKCOL,PROPFIND,GET,HEAD,PROPPATCH,OPTIONS,MOVE,PUT,GET,HEAD
curl -i -X OPTIONS http://example.com

# To create folder
curl -X MKCOL 'http://example.com/webdav/new_folder'

# To delete folder
curl -X DELETE 'http://example.com/webdav/new_folder'

# To delete file
curl -X DELETE 'http://example.com/webdav/somefolder/somefile.txt'

# To upload file
curl -T '/path/to/local/file.dat' 'http://example.com/webdav/somefolder/somename.dat'

Examples Demo Here
Code:
$ curl -i -X OPTIONS https://www.webdavserver.com/Userf7f3492
HTTP/1.1 200 
Set-Cookie: JSESSIONID=AE4266FF2F7C7AF69529A20E81F10BF7; Path=/; Secure; HttpOnly
X-Engine: IT Hit WebDAV Server v4.3.3515 (Evaluation License)
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, PUT, GETLIB, VERSION-CONTROL, CHECKIN, CHECKOUT, UNCHECKOUT, REPORT, UPDATE, CANCELUPLOAD, HEAD, OPTIONS, GET, POST
Access-Control-Allow-Headers: Overwrite, Destination, Content-Type, Depth, User-Agent, Translate, Range, Content-Range, Timeout, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Location, Lock-Token, If
Access-Control-Expose-Headers: DAV, content-length, Allow
Access-Control-Max-Age: 2147483647
DASL: <DAV:basicsearch>
DAV: 1, 2, 3, resumable-upload, paging
Allow: OPTIONS, PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, SEARCH
Public: OPTIONS, PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, SEARCH
Accept-Ranges: bytes
MS-Author-Via: DAV
Content-Length: 0
Date: Thu, 30 Jan 2020 15:43:22 GMT

curl -i -X MKCOL https://www.webdavserver.com/Userf7f3492/testabc
HTTP/1.1 201 
Set-Cookie: JSESSIONID=F91D6FE1A7D529E1FCDFAA89C4149015; Path=/; Secure; HttpOnly
X-Engine: IT Hit WebDAV Server v4.3.3515 (Evaluation License)
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, PUT, GETLIB, VERSION-CONTROL, CHECKIN, CHECKOUT, UNCHECKOUT, REPORT, UPDATE, CANCELUPLOAD, HEAD, OPTIONS, GET, POST
Access-Control-Allow-Headers: Overwrite, Destination, Content-Type, Depth, User-Agent, Translate, Range, Content-Range, Timeout, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Location, Lock-Token, If
Access-Control-Expose-Headers: DAV, content-length, Allow
Access-Control-Max-Age: 2147483647
Content-Length: 0
Date: Thu, 30 Jan 2020 15:44:48 GMT


Last edited by Akshay Hegde; 2 Weeks Ago at 12:45 PM..
These 2 Users Gave Thanks to Akshay Hegde For This Post:
 
Test Your Knowledge in Computers #827
Difficulty: Medium
Douglas Crockwell first specified and popularized the JSON format.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP script for sending a file from one unix directory to another unix server director

Hi, My local server is :/usr/abcd/ Remote server is :/Usr/host/test/ I want to send files from local unix directory(All files starting with O_999) to remote host unix directory. Can any body give me the Unix Shell script to do this. One more doubt: Shall we need to change the file... (1 Reply)
Discussion started by: raja_1234
1 Replies

2. Programming

sending file from server to client

hi dear i m very new to socket programing . i need the source code which sends file from server to client . i mean both server n client programe which sends file . can u do this for me please my email id is email id removed regards bilal (1 Reply)
Discussion started by: bilal
1 Replies

3. Programming

Sending mail in C/C++ in unix server

Hi Frnds, I have a task in my project wherein i have to send out a mail from my C++ code.With some file attachements.Please help me in this. At a higher level wat i can tell is my code generated 3 csv file and i have to send these files as attachement. My code is executed in unix... (6 Replies)
Discussion started by: electroon
6 Replies

4. UNIX for Dummies Questions & Answers

WebDav/davfs mounted file & directory names in all UPPERCASE

Hey, I have a WebDav directory mounted and everything seems fine except for one thing. All file/directory names appear in all UPPERCASE, when in actual fact they are lowercase on the remote machine. For example: foo/bar/baz.html on the remote host, appears on my local machine as... (0 Replies)
Discussion started by: MrMoney
0 Replies

5. Shell Programming and Scripting

upload file to webdav server

Hi all i have a such question this is my shell script my script must upload file to webdav server ////////////////////////////////////////////////////////////////////////////////////////////////////////////// #!/bin/sh ###... (1 Reply)
Discussion started by: knut
1 Replies

6. Solaris

Sending a file to a server

Dear Experts, please help i am very much confused here and not getting the right path, actually i want to send a file from client to a server, initially i used mmap() which is failing most of the time so i want to use general IO streams to do that, i can open a file in "rb" mode and read... (1 Reply)
Discussion started by: vin_pll
1 Replies

7. Shell Programming and Scripting

Perl and sending file to server

Hi, I am trying to write some test code for bigger project where my perl script will send file over to server. This is the current SERVER and CLIENT code I have so far. When I type "hi" from client I get hello back from server and like wise I send send command I get respond back the problem... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

8. Shell Programming and Scripting

Sending a file to 24 Server locations parallely

Hi All, I have to send a processed file to 24 different server locations. I feel, if this job can be done parallel in the background - Time will come down. I found the script to FTP the file for a single server location through past Unix posts as below: #!/usr/bin/ksh ftp -v -n... (16 Replies)
Discussion started by: vsmeruga
16 Replies

9. Shell Programming and Scripting

Perl: Sending file from UNIX server to Windows server

I'm trying to write a Perl script where a file from a UNIX server box connects to a Windows server box and copies that file into the Window box. The main problem I have right now is that whenever I try to connect to the Windows box, the connection is refused. The error message that always pops... (2 Replies)
Discussion started by: kooshi
2 Replies

Featured Tech Videos

All times are GMT -4. The time now is 12:11 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy