I'm trying to upload a file into Azure blob storage. My application is hosted in the Azure app service Linux server. Now when I request to file upload from a remote machine, I want a file to be uploaded from the given path.
I have three request parameters which take the value-form GET request
- https://testApp.azurewebsites.net/blobs/fileUpload/
- containerName:test
- fileName:testFile.txt
filePath:C:\Users\testUser\Documents
@app.route("/blobs/fileUpload/") def fileUpload(): container_name = request.form.get("containerName") print(container_name) local_file_name =request.form.get("fileName") print(local_file_name) local_path =request.form.get('filePath') ntpath.normpath(local_path) print(local_path) full_path_to_file=ntpath.join(local_path,local_file_name) print(full_path_to_file) # Upload the created file, use local_file_name for the blob name block_blob_service.create_blob_from_path(container_name, local_file_name, full_path_to_file) return jsonify({'status': 'fileUploaded'})
local_path =request.form.get('filePath') the value which I get from the request is C:\Users\testUser\Documents\ becasue of which I get this error
OSError: [Errno 22] Invalid argument: 'C:\Users\testUser\Documents\testFile.txt'
all I want is to get the same path that I send in the request. Since the application is hosted in the Linux machine it treats the path as a UNIX file system if I use OS.path
please help me with this