Closed lanrehnics closed 8 years ago
As the exception message says, 'Address is a relative address. Only absolute addresses are permitted. '. So, when you're creating the block blob, you're creating with a relative address rather than an absolute address. Ie, result.getImageUri() is returning a partial rather than full address. If you step-through debug you'll be able to see this. Make sure the URI you pass has a form something like https://myaccount.blob.core.windows.net/mycontainer/myblob
The link you drop is dead..
Yes, this is an example of a url format, not meant to be clicked. Please compare the URL you are passing to the method with that form, substituting of course 'myaccount' for your account name, 'mycontainer' for your container name, and 'myblob' for your blob name.
Am uploading via mobile service.. Please Every is generated i cloud.. The Relative address is it the address of the file I want to upload .. Or the imageUri .... Or Please can yu write a tutorial that make one select a local file and upload to azure instead of taking a picture.. Please walk me through cos I pritty much need it very sooon..
result.getImageUri() >> I don't know what this outputs so I can't do anything to help you. This needs to be an absolute address, like the example I gave. This should be the URI of the blob you want to upload to.
@lanrehnics Haven't heard anything since Oct so closing this issue. Feel free to reopen with any follow up or open a new issue if you have additional questions.
//When I click on the button it called the code below.. // then this launches an intent of file picker..
public void browseFile(View view) {
//After it calls the on activity result protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// the filepath is a Uri variable filepath = getRealPathFromURI(Upload.this, data.getData()); filePath.setText(filepath);
// this method help get the real path public String getRealPathFromURI(Context context, Uri contentUri) { Cursor cursor = null; try { String[] proj = {MediaStore.Images.Media.DATA}; cursor = context.getContentResolver().query(contentUri, proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } finally { if (cursor != null) { cursor.close(); } } }
//then here is the uploading code public void uploadPhoto(View view) { if (mClient == null) { return; } linearOverlay.setVisibility(View.VISIBLE); txt_notifyier.setText("Inserting"); // Create a new item final Uploads item = new Uploads(); item.setVersion(et_uploadVersion.getText().toString().toLowerCase()); item.setContainerName("todoitemimages"); item.setName(et_uploadName.getText().toString().toLowerCase()); // Use a unigue GUID to avoid collisions. UUID uuid = UUID.randomUUID(); String uuidInString = uuid.toString(); item.setResourceName(uuidInString);