How to find the Folder/path details of the file selection in ReactJs (Input type= File), - reactjs

I am looking for ways to find the Folder/Path details of the file selection in ReactJs,
I see all the examples concentrating on file selection only, I need to know the path details for my application.

you can't access to file path on the users' client for some privacy/security reasons, imagine this was possible, Then web apps could track users with this argument!
a NOTE about using ReactJs with ElectronJS: but if you work with ElectronJS you can do that by reading path of file object or use dialog API

Related

Get file system by angularjs or jquery

I'm using angularjs and spring framework to generate jasper report and save report to file system by
File newFile = new File("/home/person/report");
So the reports saved automatically to this path.
What I want to do is, make update that let user choose the path of the report by dialog box that enables user to navigate the local file system and select the desired path.
I want to get the path from angular and send it by REST service.
Accessing files directly is not supported.
If you insist doing that you can write a browser extension that does these operations or porting your web to a native-web application using frameworks like Electron
However,
You can (and should) use file uploads ...

Invoke File save as prompt while Downloading in ExtJS

I want to invoke the file save as prompt while allowing the user to download a file in ExtJS from a URL.
Basically the idea is to allow the user to change the file name and select his desired location before saving the file on their machine.
Is there any way I could do this?
I do not want to use:
A server side code to send the headers.
Nor do I want to use the Flash-based Downloadify library to do this.
Also, <a> tag's "download" attribute does download the file, but it does not prompt the dialog box if the browser settings are not set right.
Is there any way apart from the above where we could handle the file download in our application?
No, it cannot be done with javascript alone due to the security restrictions of the contemporary browsers. You can read files but I have no knowledge of a way to save files directly from the javascript alone.
If your "I do not want tos" are not that strict, here you can find an example of file downloading. The essence is to send "Content-Disposition: attachment" header.

Access Specific PDF Page in WPF WebBrowser Control

I have a webbrowser control in my application that is used to display pdf files that have been created in iTextSharp and are stored locally on the hard drive.
I would like to be able to navigate the file (next, previous, first, last, toc) from my application rather than using the inbuilt nav of the reader in the browser.
I have seen that you can navigate to specific pages by using
Browser.Navigate("filename.pdf#page=?);
This works the first time but when trying to navigate to a different page, it makes the browser disappear completely with no errors. However, I can reload the file without problem if I don't have the #page=? suffix on the file url though. Any ideas on this?
Alternatively, is there anyway in iTextSharp of adding something to the file to allow for it to be navigated from an external command?
All the official parameters that can be used to navigate through a PDF using parameters in the query string after the ? character are listed in a document published by Adobe: Parameters for Opening PDF Files
You already mentioned the page parameter. Another option could be using named destinations: nameddest=destination. In this case, you need to add the anchor with name destination to the file using iTextSharp.
Note that not all viewers implement these parameters. Adobe supports them in Adobe Reader and in the Adobe Reader plug-in, but there is no guarantee that they will work in pdf.js (Firefox), Pdfium (Google Chrome),... If your browser disappears when using an open parameter, you may have hit a bug in the browser or the viewer plug-in that causes the browser to crash. iTextSharp nor iText can crash a browser ;-)
There are no other ways you can navigate a PDF from an external application. The only thing you can do, is to add JavaScript to the PDF so that it always opens at the same page. This is done using an open action. I don't think this solves your problem as it would mean that you have to change the PDF file every time you want it to open at a different page.

IE file download box get location

i am currently working on a issue where i need to get location of the file downloaded.First let me explain the scenario.
I placed a link in my page and when user clicks the link it shows file download dialog with open/save/cancel options in IE.Now when the user clicks on the save button and choose a location to save the file i need to get that file saved location using whatever options possible.
Thanks!
I do not think you can... at least not easy. This runs on the client, and for security reasons you can not acces the client's filesystem with javascript.
Maybe it is however possible using a flash or silverlight plugin, as the user can allow access from within these applications to the local filesystem. It might be very difficult tho...
The browser will not allow you to access information about the clients filesystem.

different way to upload file

Is there a way to upload a file by copying a file from the desktop and pasting it into a text input which will obviously just display the filename, rather than going through the file window and selecting the file?
Talking about web applications, that could be possible if you install a custom ActiveX object or even a Java applet, or maybe trying to exploit a browser vulnerability. But, most straight way to do that will be using a <input type='file'>
For client applications, you can do that, if your current user have appropriate permissions, like accessing your file system and accessing your web server through HTTP.
Anyways, you must provide more details to get more concrete answers.
I think this is not possible and should not be possible as this is a security issue. Consider the following scenario:
A malicious site example.com shows you a harmless looking form where they have hidden such a file upload textfield with the already inserted value '/etc/passwd'. They have used either a hidden_field or just display:none with CSS.
You fill in the form and submit without knowing you have also sent a file.

Resources