I currently have an application that downloads files from a server and by default they are stored under /storage/emulated/0/ . I set it up so they download to a folder called "data". The files successfully download and unzip to /storage/emulated/0/data/unzipped , however, when I try to load an html file, stored under the data folder, into a webview, I get an error saying the file can't be found. I double checked the file path of the html file using Astro File Manager and was able to verify I have the right file path. Here is the statement I use to load the html file into the webview.
wb.loadUrl(Environment.getExternalStorageDirectory()
+ "/data/unzipped/output.html");
I have tried it with and without the .html extension and still no luck. Any ideas? Are there are restrictions on accessing the emulated storage?
File paths are not URLs. Use the file:// scheme to access files.
Related
In java controller of Spring web app, I create a report and write it to AuditReport.html. The write works ok and when I search for the file, I find it in /home/emm/Oracle/Middleware/user_projects/domains/base_domain/AuditReport.html.
I want to write it to some place that I will be able to download it with a download link.
In Eclipse I modify the weblogic.xml file so it contains a Virtual Directory Mapping entry. Local path is set to "/app/config". In that folder I created "download" folder. I add URL Pattern of /download/* to we
In the jsp file I have link like this
<a href="download/AuditReport.html" download>Export Report</a>
When I click it in Chrome I see it trying to download it but then says "Failed - No file"
Any suggestions?
you mention the file is getting generated at /home/emm/Oracle/Middleware/user_projects/domains/base_domain/AuditReport.html
where are you mapping /home/emm/Oracle/Middleware/user_projects/domains/base_domain/ to your virtual directory ?
I am having problems with accessing file in public directory after deployment.
The stage command give me a folder target\universal\bin where my .exe file is.
In development mode I used to upload my files to public\uploads\pictures and access them from this location. But, after deployment I am unable to upload the pictures. I read this Stack Link that has two options. Is it possible to define a folder directory that is not absolute.
Application Conf
myUploadPath="public/Upload/Pictures/"
Accessing folder
String myUploadPath = Play.application().configuration()
.getString(myUploadPath);
Please tell me a solution to overcome this..
Found a solution
During development we are using public directory to store anything extras(in my case uploaded files) that we have. But, while deploying the application it is important that we change the reference to these extra files. I have changed the path from public directory to the absolute path of where the file is executed using
Play.application().path().getAbsolutePath()
and store the files in this directory.
If you don't want to use this than you can also specify an External Asset
I have a desktop application which uploads files to an upload servlet. I want that uploaded files to be saved into a folder outside Tomcat, which is already mapped.
The url for the mapped folder is: "localhost:8080/MyApp/documents".
Physical path for the mapped folder is: /Users/gyo/Documents/MyApp/documents
Probably I'm making a newbie mistake but I would like to know: Is it possible to save the files in the mapped folder? If yes, how can I do that since servletContext.getRealPath("") is returning me the full path where the app is deployed?
Here is a link that explains how to upload files in Java running on tomcat and spring. Look for permissions on that folder "ls -ltr /folder-path/" to see owner and write permissions.
http://www.gingercart.com/Home/java-snippets/upload-images-java-code-example
Also look at java policies set on Tomcat for file/folder permissions at $CATALINA_BASE/conf/catalina.policy
I'm doing a web application where I can upload and download pdf files from server.
In this I created a pdf files and stored its path on the database.
What I want is when I search by some criteria (like filename) I should get list of files from db. When I click open link it should be opened in jsp.
Downloading part was done by me. What I need is just to open a pdf in jsp.
is it possible to open server file from jsp?
Place those files outside WEB-INF folder and access. WEB-INF folder is secure in a Java EE environment. By placing your files inside the WebContent folder and outside the WEB-INF folder will help you to access those files for download. You need to mention the full path for that file. E.g for an image your path will be https://localhost:9444/AppName/resources/theme/images/logo.png
i want to download folder containing files like pdf,jpg,png etc from web services.I have written a application that can download pdf,png file.But i want to download folder containing several files. So my question is- is it possible to download folder and if yes then how can i download folder from server in android. thank you
If you can download one file, why wouldn't you be able to download several? Create the folder on Android, queue the files and start the next download when the current is finished, filling the folder. Also Android supports ZIP, so that might be your best call.
Folder is nothing but an FILE but a different type of file. Once you get the folder you can list down the files in it. You already have URL with the folder, u just need to append the URL of the folder to the files in it and download them one by one.