Demo written in Java: upload files to Baidu Network Disk (Baidu PCS)

Source: Internet
Author: User

Why is there this Demo? There are roughly two reasons:

1. Android PCS sdks are officially provided. However, some mobile app developers may only use a small part of Baidu PCS. They wish to implement their own functions to reduce the application size without linking the SDK.

2. developers who use Java as the server obviously cannot use the Android pcs sdk.


Technical documents:

PCS official API description


Usage:

1. Download The PCSUploadDemo. java code.

2. compile it.

(1) here the Java library of Apache Http is used, so download it first: http://hc.apache.org/downloads.cgi. Prepare the jar files.

(2) Set CLASSPATH for compiling:

oliverluan@YanqiangtekiMacBook-Pro:~/Documents/EvWork/PCSUploadDemo$ javac -cp "httpcore-4.3.2.jar:httpclient-4.3.3.jar:httpmime-4.3.3.jar:./" PCSUploadDemo.java

3. Run:

oliverluan@localhost:~/Documents/EvWork/PCSUploadDemo$ java -cp "httpcore-4.3.2.jar:httpclient-4.3.3.jar:httpmime-4.3.3.jar:./:commons-logging-1.1.3.jar"  PCSUploadDemoUsage: PCSUploadDemo file_to_upload destination your_access_token

Source code: PCSUploadDemo. java


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.