Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the file name? #17

Open
MestreKarin opened this issue Aug 13, 2020 · 2 comments
Open

How to get the file name? #17

MestreKarin opened this issue Aug 13, 2020 · 2 comments

Comments

@MestreKarin
Copy link

How can I get the full path of the image (including it's name)? After the user save the image, I display that window for him to share, but I need the full file path.

@MestreKarin
Copy link
Author

Ok, I read the source and done two modifications:

In savePhoto() function, I created a string variable imageName after imageUri variable, then, on callbackContext.success call, I pass the path with file name.

private void savePhoto() {
	Uri imageUri = null;
	String imageName = "ep_" + System.currentTimeMillis() + (this.format.equals("png") ? ".png" : ".jpg");
	
	//...
	//...
	
	callbackContext.success(imageUri.getPath() + "/" + imageName);
}

In my app, I receive something like this: /external/images/media/1539/ep_1597346437716.png.

The Problem

Even though the share window recognize as image (see image below), no matter what app I choose, I doesn't accept it. With gmail, it says "cannot attach file". Whatsapp says "The file format is not supported". This is weird, since I can see and share the image normally if I go to my gallery.

Screenshot_20200813-163225_Android System

I'm using this plugin to share, passing the file path in files property.

@rodrigograca31
Copy link
Owner

its probably because of the location. you have to write in a folder that is accessible to all apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants