Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
247 views
in Technique[技术] by (71.8m points)

javascript - Uploading files to an ownCloud server programmatically

I am trying to set a web application where many clients can connect through a Node.js http server and then upload/download files that will then be shown in different displays. I am thinking about having those files stored in a free cloud service that can be integrated to my app. Oh, and I am also using socket.IO in this project.

Dropbox offers some API to do this: https://www.dropbox.com/developers but I was looking into a free solution like ownCloud where I can have a larger amount of storage and also have my own private server.

Does anyone know if this can be done? or can offer any tips about alternative solutions to my problem? I would really appreciate any help with this since I am quite new to all this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

@Javier Gonzalez, To upload a file...

Bad option:

curl -X PUT "http://yourserver.com/owncloud/remote.php/webdav/file.zip" -F myfile=@"/Users/Javi/Downloads/file.zip"

For, the uploaded file will contain the http headers.

Better option:

curl -X PUT "http://yourserver.com/owncloud/remote.php/webdav/file.zip" --data-binary @"/Users/Javi/Downloads/file.zip"

Or just use curl -T filename url to upload


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...