Closed amanpwl92 closed 8 years ago
entity.getSasQueryString()
How are you generating the sas query string?
var azure = require('azure'); var qs = require('querystring'); var appSettings = require('mobileservice-config').appSettings;
function insert(item, user, request) {
var accountName = appSettings.STORAGE_ACCOUNT_NAME;
var accountKey = appSettings.STORAGE_ACCOUNT_ACCESS_KEY;
var host = accountName + '.blob.core.windows.net';
var blobService = azure.createBlobService(accountName, accountKey, host);
// Provide write access to the container for the next 5 mins.
var sharedAccessPolicy = {
AccessPolicy: {
Permissions: azure.Constants.BlobConstants.SharedAccessPermissions.WRITE,
Expiry: new Date(new Date().getTime() + 5 * 60 * 1000)
}
};
// Generate the upload URL with SAS for the new image.
var sasQueryUrl =
blobService.generateSharedAccessSignature('prescriptions',
item.resourcename, sharedAccessPolicy);
// Set the full path on the new new item,
// which is used for data binding on the client.
item.imageUri = sasQueryUrl.baseUrl + sasQueryUrl.path;
request.execute();
}
I'm still unclear what getSasQueryString returns and I see a couple issues with the Node code you've published:
Am having this kind of exception too but when I get the exception message ..It goes like "Address is a relative address. Only absolute address are permitted" So the question is how do I generate Absolute address..
That exception message means something pretty different I think. Could you post a new issue with the segment of your code having an issue and a stack trace please?
Have Opened it.. Thanks looking forward to your reply..
@amanpwl92 Haven't heard anything since Sep so closing this issue. Feel free to reopen with any follow up or start up a new issue if you have additional questions!
Here's my code in onCreate method :
Other methods called from onCreate(directly or indirectly) -
// Create a File object for storing the photo private File createImageFile() throws IOException { // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); String imageFileName = "JPEG" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORYPICTURES); File image = File.createTempFile( imageFileName, /* prefix / ".jpg", / suffix / storageDir /_ directory */ ); return image; }
}