Electron React upload image from USB Path only - html

html input file attribute open file choosing in computer and can see all folder, can it customized to only open specific path like USB(cannot open other folder).

Related

how to properly link source in html inside folders?

i have multiple folders with other htmls, i want to link them all between each other.
folder structure looks like this:
Main Folder
index.html
nav.js
Project Folder
project1.html
project2.html
images
image1.png
image2.png
this is how i try to link:
index.html:
project1.html: <img src="./images/image1.png> <script src="./nav.js">
it works with visual code live, but doesn't work when i open just index.html.
i get error for not loading neither image or script, and when i press on a i get another error of page not found.
i want to figure out what is proper way of linking items inside multiple folders and in which case i have to use "./" or "/" and if there is anything else.
When you start a URL with "/", it goes to the very beginning (root) of the path.
When using VSCode Live Server, it runs a local server which has a root path of the directory you have open in VSCode. With live server, you will have a URL like localhost:5000/index.html. As the root path is in the same location where the index.html is located, you can just type /index.html to access it.
When you manually open the index.html, the root directory changes to the root of the drive you have the file located in (e.g. C:). If you open the file manually, your web browser is opening something like C:/Users/User/Desktop/Website/index.html. If you were to try access /index.html, it would then go to C:/index.html on your hard drive.
If you are trying to access a file that is in the same directory as the current html file you have open, you want to remove the / from the beginning of the URL.
If you are wanting to access a file that is accessible from the parent directory, you want to have it start as ../
To make what you currently have work when you directly open the .html file, make the following changes:
index.html
Before:
After:
project1.html
Before: <img src="./images/image1.png"> <script src="./nav.js">
After: <img src="../images/image1.png"> <script src="../nav.js">

How to load HTML file from another assembly to WPF WebBrowser Control

These are the projects in my solution:
HTMLApp (TypeScript) - contains index.html
WebBrowserApp (WPF) - contains main.xaml with WebBrowser control
I want to load the content of index.html into the web browser control inside main.xaml. Build Action of index.html is set as Resource.
I tried this code in the XAML but did not work:
myBrowser.Navigate(new Uri("pack://siteoforigin:,,,/HtmlApp/index.html"));
The WebBrowser control doesn't work with pack URIs.
The Source of the Uri that you pass to the Navigate method is supposed to be a URL or an absolute file path. The WebBrowser control doesn't support browsing resources or relative paths.
You could change the Build Action of index.html to Content, set the Copy to Output Directory property to Copy if newer and then navigate to the local file like this:
myBrowser.Source = new Uri(string.Format("file:///{0}/index.html", Directory.GetCurrentDirectory()));

CKEditor external image path

I"m having an option to insert image inside CKEditor. For that i saved the image file in physical path inside the Server(Wildfly 10) folder and adding an img tag by using editor instance with (instance.insertHTML) option. Its working fine when the image was inside the server folder. If the image was outside the server path its not rendering in the editor as well as in the browser.
Help to store the image in external path (outside the Server path) to render the image in CKEditor as well as in the browser.
I'm using primefaces extension for CKEditor.
Your web application only has access to certain areas of the file system served from under the webapp. This is fundamental webapp security so a user couldn't browse your server's file system for example.

Use html hyperlinks to index file folders

I am trying to index the file folders on my local computer using a html file. I set hyperlinks to the folders, when click the link, the internet browser (firefox in my case) lists the files contained in the folder. However, is it possible to open the file browser (linux) when click the link, rather than listing the files within the internet browser?
I do not believe this is possible because HTML controls web objects and wouldn't be able to open and search a path in a file browser. For that has to do with the physical computers file system not the internet.
If you need to me explain more just let me know

Opening a Local PDF file in Browser using JSP

I have tried to open a PDF file from the local disk.
For example the Location is:
E:/files/IT/cat1/cat1Notification.pdf
But during runtime the link changes to:
http://localhost:8080/Office_Automation/E:/files/IT/cat1/cat1Notification.pdf
How to do i get rid of http://localhost:8080/Office_Automation/ from the link and open the file?
I have used
click here
To open the local file you need to use the file scheme in your URL
As you path is a Windows path E:/files/IT/cat1/cat1Notification.pdf, the link's href needs file:/// added before the your jsp's <%=path%> variable, so that the browser knows it needs to open a local file on the user's machine.
So your link should look like this
click here
Which in your browser will resolve to file:///E:/files/IT/cat1/cat1Notification.pdf
Without the file scheme the browser assumes that your link is relative to the webpage and tries to resolve the link by making a request to your webapp. This is why you were getting http://localhost:8080/Office_Automation/E:/files/IT/cat1/cat1Notification.pdf