Upload Files
UploadFile()
This section describes how to upload files to OBS. During the file upload, other threads are blocked (in the waiting state). They are unblocked until the files are uploaded successfully. You can configure the target OBS bucket on the HiLens console. For details, see the "Configuring the Data Storage Location" section in HiLens User Guide.
- API calling
HiLensEC hilens::UploadFile(const std::string & key, const std::string & filepath, const std::string & mode)
- Parameter description
Table 1 Parameters Parameter
Description
key
Name of the file uploaded to OBS
filepath
Absolute path of the file to be uploaded
mode
Upload mode. The options are write (overwrite) and append (add).
- Return values
If the return value is 0, the operation is successful. Otherwise, the operation fails. For details about the failure response parameters, see Error Codes.
UploadFileAsync()
The following API is used to asynchronously upload files. A response is returned immediately after a file is uploaded successfully.
- API calling
HiLensEC hilens::UploadFileAsync(const std::string & key, const std::string & filepath, const std::string & mode, void(*)(int) callback = NULL)
- Parameter description
Table 2 Parameters Parameter
Description
key
Name of the file uploaded to OBS
filepath
Absolute path of the file to be uploaded
mode
Upload mode. The options are write and append.
callback
Callback function
- Return values
If the return value is 0, the operation is successful. Otherwise, the operation fails. For details about the failure response parameters, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot