Cabrejos, Jason J Greetings & Welcome to Microsoft Q&A forum!
I understand that you are trying to upload files to Azure Blob Storage.
when I try to upload the file it always uploads with the filepath DEVICENAME/file.jpeg
The documenation you are following uses the BlobClient
class from the azure.storage.blob
package to upload the file.
The BlobClient
class has a upload_blob
method that takes the blob_name
parameter to specify the name of the blob. By default, the blob_name
parameter is set to DEVICENAME/file.jpeg
.
What if I want to upload a file with a different filepath such as /Location/DEVICENAME/Date/file.jpeg. or what if I don't want to upload using the Device Name at all?
To upload the file with a custom filepath, you can try to modify the blob_name
parameter in the upload_blob
method.
For example, to upload the file to /Location/DEVICENAME/Date/file.jpeg
, the blob_name
parameter should be set to Location/DEVICENAME/Date/file.jpeg
.
If you would like to upload the file without using the device name, you can set the blob_name
parameter to the desired filepath.
For example, to upload the file to /Location/Date/file.jpeg
, the blob_name
parameter should be set to Location/Date/file.jpeg
.
Looking at the documentation for BlobClient, if I change the blob_info["blobName"] filepath it leads to authentication problems.
It's important to note that the blob_info
parameter is not used in the upload_blob
method. Instead, the blob_name
parameter is used to specify the name of the blob.
If you are still having authentication problems, you may need to check the Azure IoT Hub permissions and access rights.
You can refer to the Azure documentation on IoT Hub access control and Upload files with IoT Hub for more information.
Also, refer to Azure Blob storage client library v12 for Python for more information on using the BlobClient
class to upload files.
Do let me know if that helps or have any other queries.
If the response helped, please do click Accept Answer
and Yes
for was this answer helpful.
Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.