Copy local file to another location with a web page - javascript

I do not know if this is possible to do.
What I want to achieve is a web page (online) where once you select an image from my pc via a classical input in html, let me copy it to another folder always inside of my PC (or a PC connected to the network local).
I can do this thing? Maybe with javascript?
There are other possible solutions?
Thanks.

You cannot do this. Websites have no permission to access Your computer local system. With HTML <input type="file"> You can only send files to the chosen website directory. Eventually, You can download those files later and put them on the other place in Your system.

Related

Download and open a file by javascript

I am making a SPA.
I want to download a file (e.g. .xlsx) and open a "Open With" dialog like this, by javascript.
Or open the file on client's PC.
Is there a way to solve this?
I know javascript cannot access to local files without
<input type="file">.
I want any advice. (even THIS IS IMPOSSIBLE)
I'm assuming your SPA has an API? Well, you need to the direct the user to an API endpoint that will create and then send to the client the .xlsx file.
You can use the Content-Disposition header to control how the browser will open the file.
Kind regards,

Get Client system's directory/folder list using client script HTML/JS

Related to this topic I know that impossible to get local computer folder list from webpage.
https://forums.asp.net/t/1326036.aspx?Get+Client+system+s+directory+folder+list+using+client+script
But how about if I open a html file on my own computer, it will be any way to do it?
Or i need to create .exe which will display my html and include some function to read files on computer...
Thank for any sugesstions.

Is it possible to access a local file from a browser on a mobile device?

Question:
Let's say I create an android game that saves a save file(in the form of a text file) on the local android internal storage and I know the absolute path where the file is saved. Is it possible to create a website with a built in script that retrieves this textfile and displays the save data to the user? If not, why and are there any unconventional ways to get around it?
From my own research, I have seen similar topics give pretty mixed results. Some say that the browser is sandboxed, while others say that it's now possible. Any clarification would be appreciated! Thanks in advance!
It may be possible if you have a local web server running on your Android Device. If you can save the file to the Web Server Document folder, you can then access the file from your browser. I haven't tried it, but it sounds logically possible.

Loading a local image with JavaScript/jQuery where I know the location, but not the file name

The new version of Linux Mint allows HTML 5 login window themes -- I'm trying to write one that will grab each user's wallpaper. These wallpapers are located in the folder /home/#USER#/.cache/wallpaper/, however the file name is not consistent and I need a programmatic way of determining it. Once I know the filename, the login screen will display the image correctly using the file:///.. format.
I don't have any tools other than client-side HTML/CSS/JavaScript[/jQuery/etc] available to me. Is there any way I can grab the file names in that directory, so that I can grab the wallpaper image?
EDIT: Figured it out! The browsers won't allow access to the file:/// resources at all, the mdm-theme-emulator will.
It looks like these files are located on the client machine, in which case you would not be able to access them using jQuery. Javascript does not have access to the local file system.
If you are sending the request through a server, you'd be able to use the server-side code (ASP.NET, PHP, etc.) to loop through the filenames

How can I let users upload files by copy/paste?

I'm trying to create a web app based on ExtJS, and I'm working on the file-upload area of the app.
I want users to be able to upload files by copying and pasting them - not just copying and pasting the contents of the file, but the file itself. For example, in Windows, you can choose "Copy" or "Cut" from the Edit menu while a file is selected, then choose "Paste" later and copy or move the file - I'd like users to be able to upload files to my app in the Paste step, by just choosing Paste in their browser.
I've already tried HTML5's drag-and-drop API, but we don't want to use that - we want users to be able to copy/cut and paste files to upload their files (as long as they're smaller than 20 megabytes). If the user copies the path to their file and pastes that directly to the page, telling us where to find the file, that could also work.
Can anyone suggest a way to do this?
The thing is, that you're not able to access the clients filesystem with javascript. There is this new Filesystem API, but this just allows you to create a virtual sandboxed filesystem. I had the same problem, thought about it a while and came up with the following ideas.
Flash
Writing a Flash bridge which access the filesystem and let the javascript communicate with it via swliveconnect
Problem: Flash doesn't have filesystem access either.
Java applet
Same thing as Flash and again with LiveConnect
In my opinion this could work, but I didn't try it out, because my goal was to get filesystem access on a chromebook. And chromeOS doesn't support Java (at least without some hacking)
ActiveX
I also found some solutions with this. I gave up at the applet part so I didn't try this out either.
As Jared Farrish said, when you copy a file the os just saves the path to the file in the clipboard. Then if you receive the paste event on your webapp just get the string out of the clipboard and forward it to your file bridge.
I've seen that DropBox.com allows this to be done (in chrome- didn't seem to work in IE). I didn't do cut and paste specifically, but dragged files into a dropbox page from a local folder, and it uploaded the files. So, this doesnt directly answer your quesiton, but perhaps you can look at how this is done in their code.

Categories

Resources