How to rename a file while downloading from a website using javascript? - javascript

I have a web page which contains link to another website in different domain say "example.com\abc.msi". when I click on the link, the file starts downloading but I need to rename this file while downloading from that website. How can I accomplish this? I tried using download attribute of anchor tag, but for some reason its not working. This needs to be done in client side. Please help!

You cannot change the name of the file to be downloaded for it would be a security issue. You can imagine clicking a file image.png, and getting image.png.exe instead. This is not something browser developers would alow.

your abc.msi is a ftp file so whenever anyone call to the file or click on the link it will either be automatically downloaded or open a dialog for saving file on location
for example
hence it's up to the user where and how he wants to save the file.

Related

Creating a directory picker to download a file to clients computer using js

I have written an application where on button click a .docx file is generated on the server and returned to client as base64 string. What I want to do now, is to let the user download the file in a directory of their choice.
To demonstrate what I mean, if I instead want to upload a file having a <input type='file'/> opens a dialog such like this
Where I can select the file. Is there any way to open this kind of dialog for a download button? I understand that the web-page doesn't receive the actual path on a clients pc for security reasons, but if you can chose an upload file, there is no reason to not chose a download path right?
No, for security reasons this is not possible.
See:
https://github.com/eligrey/FileSaver.js/issues/42

Download a file with javascript without any prompt name select, path select window

I'm generating pdf files from a html file using decktape (and ofc reveal.js) inside a docker image. In the html file there are multiple svg files, which i need to download separately.
My idea was to create a script which automatically downloads the svg-s with the computed css when the html file is opened. But I have to solve the problem of the prompt window. Is there any way to download files automatically with javascript without the prompt window popping up?
I'm already able to download the file with the prompt window popping up, but I would like to do it without that, automatically. This is happening on a Linux Debian 9 server, and the decktape is using a Chromium.

Is it possible to get access permission for a folder in local file system from browser

I want to make a local file editor. To open some files edit them and save them back. It's ok if it only works in Chrome. Using
<input type="file" id="filepicker" name="fileList" webkitdirectory multiple />
I can read all the files and draw the file tree but I want to also be able to edit and save to these files. Even create new files and folders.
Is there any way to do it. I'm also ok with hacks that use Java or Flash or simply any other hack if HTML5 does not offer any solution.
Thanks
I do not believe what you are suggesting is possible; however, there is a different approach that should solve your problem.
If you take Microsoft's Online Word for example... They have it setup so you save document to the cloud and then can edit them with an online copy of Microsoft Word.
In otherwords, the user would upload a file. Your server would then take the file, display it and allow the user to edit the file. The user would then save the changes to the file. You can then provide an option to re-download the file.
To more closely emulate editing a file on the local file system, you can also setup a "temporarily" save on the server.
Essentially, the user uploads a file. The server would allow the user to view and edit the file. When the user wishes to save it, instead of saving the file on the server, give it back as a download to the user.
After the user leaves your site you can delete the copy of the file that is saved on your server.

Uploading file without triggering the upload window, client side

I have been searching all over and I can't find a solution, I know it is not possible for a website to automatically upload a file without user interaction, but, is it possible to upload a file without having to manually click on the upload button and search for the file, client side. I am sorry if I'm not clear since I do not have much experience in this field.
This is the page I have tried : http://www.jist.tv/create.php
I basically been trying to make the page know what file i'm trying to upload without using this input window.
This is the script the page uses to upload the file : http://www.jist.tv/vendor/uikit-2.24.3/js/components/upload.min.js
Is there a POST message I can send?
Any help would be great, thanks.

Create text file download/update into a particular location in local client machine using JavaScript/Jquery

I want to create a text file using JavaScript and store in a particular location in my system, Suppose I want to store in:
C:\Users\RAJ\Desktop
I have found an interesting API Link
It creates and simply download the file but I can not specify the location.
please guide me how I can download into a particular location?
Note: If a file already exists in same name then it should replace with the new file.
This activity is prevented due to security. Consider if the browser was allowed to be scripted to download and replace any file on your computer. For this reason, the browser will either prompt or use the Users defined preference to download content to a specific folder. You cannot script where a download will go on the users computer.

Categories