With file_picker, I can't get file's real path or URI from FilePicker.platform.pickFiles(). It only returned something like this
/data/user/0/my_app_dir/cache/file_picker/file
and logged this
I/FilePickerUtils(27005): Caching from URI: content://com.android.providers.media.documents/document/video%3A1519
D/FilePickerUtils(27005): File loaded and cached
at:/data/user/0/my_app_dir/cache/file_picker/file
D/FilePickerDelegate(27005): File path:[com.mr.flutter.plugin.filepicker.FileInfo#705d9ef]
That's not what I want. I just want the real original absolute file path, the file information, regardless of what I'll going to do with the file. So I'm looking for a package that do that or the solution how to manually pick file and get the file path like I could do natively. Thank you in advance.
It's not impossible with native code. It's just package publisher who made it unavailable using it. Follow this to implement file path picker on native code. It works for me.
Related
I want to get gallery folder path.
I tried to use multiple libraries [path_provider, storage_path, image_save, multi_image_picker ...] to get the gallery folder path, but none of the libraries got the gallery folder path.
See, I don't find any great thing to save your file to your gallery, what I did found is to how to get your things done.
My solution will give you some things like
Save a file visible to the user
Check whether the file exists or not
Saving the file:
For saving the file we can rely on the package downloads_path_provider.
Look at this answer for using this package precisely
Flutter save file visible to the user - StackOverFlow would help you to know how he is using path_provider package to save his files.
Check whether the file exists or not
To do this, you can use this code inside your code, where you are trying to save the file, form the above answer.
Important: You will get the path of the file where you are storing the file, just pass the path in the below code
import 'dart:io' as io;
// for a file
bool exists = io.File(path).exists();
// for a directory
bool exists = io.Directory(path).exists();
if(exists) // do your operation
else // do your else operation
I am able to produce this much content for your problem. Any feedback are welcomed.
Yesterday I found this great looking plugin for file and image management for tinymce however I cannot get the files to actually save to the drive. I have tried every commbination I can think of.
responsivefilemanager.com - This plugin.
Anyone used it before and know of the settings I might need?
The plugin sits here: /public_html/cms/app/webroot/js/tinymce/plugins/filemanager
I'm trying to set it up so the uploads go here: /public_html/cms/app/webroot/files/cms
The config file for the plugin has 3 lines to configure for this, these are as follows and as I have set them up:
$base_url="http://domain.com/cms/"; // base url of site. If you prefer relative urls leave empty
$upload_dir = 'app/webroot/files/cms/'; // path from base_url to base of upload folder
$current_path = '../../../files/cms/'; // relative path from filemanager folder to upload folder
Now when I started working this out I would get an error for the plugin saying the root folder doesn't exist so I keep playing with the paths and now I don't get this error but I still cannnot get it to upload the images, everything looks like it works, I get the preview as the image is uploading and a green tick once it's complete then I go back to the files list and the image isn't there. It's not on the server either. I'm wondering if there is a way to debug this and work out what's happening?
Thanks
I ended up getting this to work with the following settings:
$base_url="http://domain.com"; // base url of site.
$upload_dir = '/cms/app/webroot/files/cms/'; // path from base_url to base of upload folder
$current_path = '../../../../files/cms/'; // relative path from filemanager folder to upload folder
Thanks
Try the following settings if you still have not got this sorted out yet:
$base_url="http://www.domain.com/cms"; // base url of site. If you prefer relative urls leave empty --> No trailing slash
// The upload directory will be a dir you have created for the files to be uploaded to, ie: localhost/cms/app/webroot/files/cms --> this file must have write permission.
$upload_dir = '/app/webroot/files/cms/'; // path from base_url to base of upload folder --> write permission (chmod = 755)
$current_path = '../../../../files/cms/'; // relative path from filemanager folder to upload folder (you are missing one "../")
// The thumbs folder located in tinymce/plugins/filemanager/thumbs must also have write permission (chmod = 755)
That should do it
use gsynuhimgupload plugin TinyMCE
http://gsynuh.com/tinymce-simple-image-uploader/136
TinyMCE simple image uploader
Here’s a repost of my TinyMCE image uploader plugin. It used to be on gsynuh-labs.com (but I let this domain go).
please note that this plugin is no longer supported by me – and I’m not responsible for any inconvenience caused by it, it is shared “as-is” and you have to be responsible when using it ie: take care of any possible injection problems/security problems in your own site’s context.
I’m not interested in expanding it myself as I was only looking for a very minimal image uploading plugin for myself but If you are going to expand on it, I can list your version on this page if you want, just contact me.
—
I am using filepicker.io and specially computer as main service.
I would like to get the original file path of a file uploaded through the API.
For example, if I upload a file located at /my/path/in/my/computer/file.zip, I will get in the FPFile object the filepicker.io URL but not the original file path.
Is there a way to get it ?
PS: I have tried to retrieve the stat of the file too without success.
Due to browser security limitations, the real local path of the file is never exposed to the javascript application. For more information, see http://davidwalsh.name/fakepath
Here i have stucked in simple concept.How to get the file-path when uploading the file in GWT. For example-(d:/example.xls) this is my upload-file. how to get this path programmatically? i have tried this
FileUpload ff=New FileUpload();
ff.getFileName();
when i use above code.it is returning only example.xls only.. help me
You can't access this information from GWT (and javascript in general)
I think, you cannot get the absolute path of a file that you have uploaded. The path will be absent or changed to avoid security risks, after you have done the upload.
You can get the file's name using the getFileName() function,
and even its content, with the HTML5 FileAPI.
I would like to save a file downloaded from the internet in iPhone.
Can I use the url as the file name? If not, what transformation should I apply to the url to obtain a valid file name?
I need to find the local copy of the file later using its url.
Edit: Not asking where or how to write a file to disk. The question is limited to getting a valid file name from an url.
Can I use the url as the file name?
You can use just about anything you want for a file name. As long as it's a valid file name for the underlying file system.
If
not, what transformation should I
apply to the url to obtain a valid
file name?
This is unanswerable because there's no way to specify what "valid" means here.
I need to find the local copy of the
file later using its url.
You probably want to save it to your application's Documents directory. There already are plenty of questions relating to saving files on iPhone here on Stack Overflow, and I urge you to read some of them.
For lack of a better method, I'm using a persistent dictionary to map the urls to unique names.