Copy a file to the clipboard in HTML - html

I've Googled around this for an hour and not found anything suitable, but it feels like something that surely should exist and be quite easy/common? So I'm asking here.
I'm planning on hosting a number of small files on my server. These contain Midi information (used in music production).
What I want is to create an HTML page that lists each of these midi files, and allows the user to click a button to copy the file straight to their clipboard, so that they don't have to download each file and then locate it in their downloads folder.
I can't find any solution for this. I've found lots of solutions for copying text, but I want to copy a file instead - Is this possible?
Primarily I'm open to using HTML, PHP or JavaScript.
Thanks in advance for any assistance.

Related

Flutter render downloaded html

I have an elearning APP in Flutter, which can render html files stored online. Now I want to download these files to assets, so they may be accessed offline. For this, I will download a zipped file with the entire html's folder and unzip it.
The problem is the html has many subfolders with it's own assets, which I would have to declare in the pubsp.yaml in order to access, but these downloadable htmls are constantly being added (every new course has new files).
I see a few ways to solve the problem:
Somehow declare access to subfolders in the pubsp.yaml.
As far as I know, this cannot be done.
Update the folder access for the installed APP dynamically.
As far as I know, this cannot be done.
Read the html file without unziping it.
I don't know if this is doable (I'm using webview_flutter_plus to render) and weather it would allow access to files in folders inside the zip without declaring them in the .yaml.
Pre-load empty folders inside assets that would mimic the html folder structure, declare them in the .yaml and then unzip and read the htmls from these folders. I would create some 100 of them in order to accomodate a large number of course downloads.
I believe this method would work, but it seems very cumbersome and inelegant.
So my questions are:
Would any of methods 1-3 work and if so how?
Would method 4 work?
Is it possible to reference folders in the .yaml file without them existing? It would make method 4 far easier.
Is there any other way to accomplish this? I cannot change the language, since the APP is months along, but plugins are fair game.
Thanks in advance!

Can I compile with electron-build and keep my html files?

I'm using electron-build to transform a "website" into an "app" and it's pretty awesome! But the compilation process obviously transforms the HTML pages into other types of files.
Is there any compilation option, flag or anything that can allow me to keep the html files and resources so that a curious user can click on index.html and use the app in their favorite web browser?
I havent found anything, so I'm considering simply copy pasting the source files in the output folder, but that's a lot of duplicate data :)
Thanks!

How can I replace some text in html on python?

My situation is...
I have few hundreds of chrome html files on one folder, and I want to replace certain text(ex. james) to another text(ex. tom) for every html files. Honestly, I'm just a beginner to python, so may I get a detailed code of it? I need 1. how to open every html file in one folder 2. how to find certain text on html 3. how to replace it to another text (on python) Thanks a lot.
you can just open up the directory in VSC and bulk replace all the instances of any string in all the HTML files directly. I required to do the same and found this to be a very convenient method.

Can I upload a file to my server using a form and POST in HTML?

I want to create a way that people can upload images to an images folder on my server using an HTML form and the input type file, I thought that the only way it was ever possible to add a file to my server was to FTP in there and drag it in. Is there a straight forward way I could create a form that would allow someone to select an image and just upload it to my folder?
Pretty straight forward example from w3schools. Comes with an example HTML and PHP script
http://www.w3schools.com/php/php_file_upload.asp
See POST method uploads for an introduction. There are plenty of file upload examples on Google.
You could find more information here : http://www.php.net/manual/en/features.file-upload.post-method.php
You are going to need some type of script on the server to handle the file. I know that you can google for and find at least a couple of PHP scripts because I had to do it a few years ago. The script can also be useful in that it can change the name of the file so that duplicate files do not overwrite each other.
Sample upload script

CHM file unreadble if saved to hdd

I've just downloaded JSon.Net for framework 4.0 as a zip file.
Opening zip (using WinRar) I'm able to open Documentation.chm file by double-clicking over the name listed and the help file is well done.
Anyway if I extract this file to hdd and I open it, help is unreadable.
Sounds silly, but it's happening.
Thanks for your help!!!
EDITED:
Another tip: unreadble chm file is located in D:\.... (second NTFS partition of first hdd); if I save it on my desktop, chm file becomes readable !!! Crazy...
------------------------------------
---------- SOLUTION ----------
------------------------------------
I answer my question to close it and to help someone who finds in my same trouble.
Using tip suggested by #Marco van de Voort I searched Google for "chm unblock" and found this link:
Your CHM files are stored in the folder with '#' (hash) character in
the path Many C# developers discovered that their documentation
and e-books in CHM format cannot be read because they were storing
their CHM files in the directories like 'C:\E-books\C#\'. The hash
character signifies an anchor in HTML so the CHM viewer fails to
resolve the path properly and to retrieve the content.
That was my problem: I had path with a #... and I'd never thought this could be a great mess for CHM files!!!
Thanks to SO mates for the help given !!
Windows keeps track of downloaded files on NTFS systems, and puts certain restrictions on them. If you extract with windows explorer, this status propagates from archive to file. Using a third party tool (winrar in your case, I use INFO zip) can circumvent this.
Some descriptions and other links can be found
http://wiki.lazarus.freepascal.org/chm_backend_for_fpdoc#Troubleshooting
Free Pascal (2.4.4) has some tool to unlock them. (chmls unblock). It is done by truncating an alternate filestream (therefore it only works with NTFS). I found this info somewhere on stackoverflow, but can't quickly find the link.
It might be that virtual folders like desktop don't fully support this.
maybe the references to some content is to web or no chm file. maybe if you can disassamble in CHM editor and change paths can fix it.
maybe this can help you
There are security permissions applied to this file type by a recent patch.
you need to unblock the file:
http://www.helpscribble.com/chmnetwork.html
instead of thinking many possibilities of "windows security permission", get a CHM reader or wrap your CHM using winrar, and doubleclick to view it like you did.
It's save your time a lot!!
So, two simple solutions are:
have a CHM reader: https://blog.kowalczyk.info/articles/chm-reader-viewer-for-windows.html
OR right click CHM file/s, > Add to RAR Archive.
If you want to read it, double click RAR file > double click CHM file. BINGO!!