Background:
We have a paid service that we download zip files from. The zip files are in a very predictable format like this
"file_<date>_Level1.zip"
"file_<date>_Level3.zip"
"file_<date>_Level7.zip"
"file_<date>_PG.zip"
The only interface to download there files are from a website that uses adobe flash and you have to traverse a navigation tree 4 levels deep, download a file, then traverse another tree 4 levels deep and download the next file. There are over 100 files and it takes a user about 1.5 days to do this.
Because the file names are very predictable - and have been for years, I am trying to generate a webpage that they can open locally on their laptop and the links point directly to the download, so when they click on the link it automatically downloads the file. something like:
www.contoso.com/resources/downloads/file__<date>_Level1.zip
www.contoso.com/resources/downloads/file__<date>_Level3.zip
www.contoso.com/resources/downloads/file__<date>_PG.zip
Every week, these files are updated and not all of the levels are there, so when I dynamically generate these links, about 25% of them fail.
Question:
I am looking for a way to check if the download link is valid, and if not perhaps gray it out or add an image that is now visible that is like a red x indicating that the file is not there.
What I tried:
I tried using AJAX, jquery, php, all kinds of things, and I mostly ran into what I believe are CORS issues? About cross-domain requests? I have spent probably 2 days on this with tons of trial and error and research. It seems like it would be such a simple thing: "Does the zip file exist at this url?"
Since the webpage with download links is really just a simple html file that they will probably have on their desktop, I also tried disabling CORS with something like chrome --disable-web-security --user-data-dir and other options.
So frustrated, any help is appreciate, also my level of AJAX, jquery, php etc. is basic, my career has been spent in SQL Server, Azure, etc.
Thanks,
Matt
Related
I am planning to create a React frontend which handles HTML presentations. Besides letting the users present online, they should also be able to download their HTML presentation as PPT (like Google Slides).
I have not yet decided on what package to use for creating the presentations, but most of the packages seem to only support the typical print-download (the PDF that is converted from the HTML when you press cmd/ctrl + P). One exception is PptxGen, but that package is not an option for me (because of reasons not related to this question).
Is there a way for me to download a HTML page to PPT?
(There are multiple ways to download html to PDF - jsPDF being one. If it's cumbersome to download html as PPT, perhaps it's possible to converting html -> PDF -> PPT and then download it? Any advice?)
Thanks in advance!
Even after extensive searching, I did not find any other open-source library that handles direct HTML-to-PPT conversions, apart from PptxGenJS, so we can conclude that if you want a direct conversion, that's your only option.
There are some other ways to do this though, one that you mentioned is converting to PDF, then to PPT. I have found a service that can do both conversions, called Cloudmersive. They seem to have a free tier, and a Javascript API client that you can use from your frontend, so this is probably worth giving a try. If this managed service also doesn't suit your needs for any reason, you can still handle the conversions yourself, for example, with jsPDF and
pdf-officegen.
Working on a Data Management System in React. I want to open the explorer window to let the user choose where they want to download a particular file stored on a server. I want to override the browser setting. Only need Chrome functionality.
Researched a lot about this, I know it's apparently a browser-side security feature
But as of recent, Chrome's apparently started supporting some File System access api so if someone could help me out with that, I'd be much obliged.
Tried the saveAs package, tried this tutorial and a bunch of other stuff to no avail.
I did find some solutions for writing text to a .txt file but the problem here is that the downloaded file could be of literally any type.
Due to the safety rules of the same-origin policy (SOP), i am unable to load certain local files when opening an index HTML-file directly with a browser. Using a "live-server"-plugin works fine, as all the files in that case are "on the same server". I need to distribute the website as a client-side only app - A folder and html file to be opened with your browser. Solutions to the problem always seem to require setting up a server. Is there any way to avoid that, and keep everything on the client?
I am making a mathematics e-book, that i want to distribute as a website people can download. I want it to be client-only and a download, since if it were to become popular, then i wouldn't be able to afford running the server (as i would be studying at that time). I have chosen html and javascript over EPUB, as they are much more powerful, and allow for tons of interactivity (and much more efficient development).
So far i have a browser.html file, that loads individual pages with JQuery .load(). This browser.html file has both html, and javascript. The CSS is in an external file. The individual pages have many pictures, that are also stored locally on the server. As the pages are contained in subfolders, the picture URL's go out into their parent folder, and into the assets folder, like: ../../../Assets/Chapter1/Talopgaver og intuition/Misc\F\solsystem.png. I use custom-elements (shadow-DOM) to handle various complex aspects such as questions, answers, along with certain other things too. Other than JQuery, i also make use of Math-Jax, and a "polymer" library that helps with cross-browser support of custom-elements. All the pages in a certain chapter are loaded in the start, and then put into a array (this makes it fast to scroll through pages as you often do in books). They (as strings) are each modified slightly to automate certain tedious parts of development.
I have tried to open the browser.html file on chrome, firefox, internet-explorer, and edge. They all load the html that browser.html inherently contains (properly styled even), but none of them load any external pages. Interestingly, one of the images used in the browser.html file still works (i would think that would be a local file too, not?). If have tried turning off calls to ajax or external CSS, but nothing changed. I have searched for other people with similair problems, but all the answers just reccomended setting up a server.
When loading the page with a live-server plugin, the result looks something like this:
browser.html page opened with "live-server" visual studio code plugin by Dey, Ritwick
When opening the browser.html page directly using chrome, it looks like this:
browser.html page opened directly with chrome
The error i get (after having removed an ajax .get() call) isn't particularily descriptive: simply "Failed to load resource: net::ERR_FILE_NOT_FOUND" from "platform.js:1". Even if turn off the call to start loading pages, it gives me excaclty the same error messages.
Looking at the network reports, with live server it looks very ordinary. without it's pretty weird. It says it takes hours to load browser.html, even though that clearly isn't the case. It fails loading platform.js, after using 22 seconds trying. The networks report looks a bit more healthy when turning off the call to load pages. It gives up loading platform.js faster (8 seconds), yet still supposedly takes hours to load browser.html.
Though it shouldn't ultimately be neccesary, i have linked the entire browser.html document below, along with an example of a page it might load (the example in the first picture above).
browser.html. Too big for a stackexchange code-block embed
Page in previous picture (page 37)
Any help is appreciated!
EDIT: Main problem seems to be the loading of pages using JQuery.load(). Even on a simple testing website that operation is just not possible without running on a server.
I have written a script in PHP that connects to my FTP server and downloads the latest backup of all the websites I have created.
I have written this script in PHP (using ftp_get and all those lovely functions!), but I have also created a nice looking dashboard in HTML, which uses AJAX to not only execute the PHP code but to output all the "echo"'s into a textarea so I know which ones were successfully downloaded and which ones failed.
My problem is that I am not the only employee, there are quite a few of us who could execute this script, so on the dashboard I want there to be a way of choosing where these backsup are saved without having to edit a hardcoded destination in the PHP. At the moment, it's hardcoded to save to my desktop, but if someone else were to use it on their computer, it won't work.
I have tried searching for this, but no one has asked exactly the question I needed answering.
If the answers could be using HTML, JavaScript/jQuery or PHP, that would be handy.
Thank you in advance.
------------EDIT------------
Not sure people are understanding my problem, so I will try and explain it differently :)
I have a backup tool that will connect to an FTP server, go through each project folder and download the latest backup of that site. In total, there are at least 20 files to be downloaded.
Multiple people will be using this tool, depending who is around to backup the files.
Bob might want to save it directly to his desktop: C:/Users/Bob/Desktop.
Barbara might want to save it in C:/Users/Barbara/Backup Folder/2017/
Jimmy wants to save it in C:/Users/Jimmy/Projects/Project_name/Backup-01-01-2017
And I might want to save it onto an external HDD.
I want the tool to have a function that will allow the user to specify a location on their HDD where these files will all be saved.
I hope this is clearer.
Many thanks.
I have been playing around with the file system drag and drop functionality of Electron apps and haven't had any issues getting everything to work with local files. I have not come across anything in the documentation, so I'd like to see if anyone knows if this is possible. I'd like to use the drag-out feature in Electron to drag a remote file outside of the app and onto the file system.
Specific example:
The program I am working on is a remote file management tool - similar to dropbox. I'd like to drag the dom element representing the remote file to a Finder (or Windows Explorer) window and have Electron download the file to that location.
I am able to get this to work as long as the file is stored locally following the Electron documentation.
http://electron.atom.io/docs/all/#dragging-files-out-of-the-window
I can envision two possible solutions:
Does electron have the ability to pass a DownloadItem or a URL to the 'startDrag' event (as referenced in the link above)?
Is it possible to listen for a 'dropped' even of some kind and get the local file system path of where my dom element was dropped? For example, /Users/{proile}/Desktop? I could use my existing download methods to download the file to that specific path.
Any thoughts on how I can accomplish my goal? Thanks so much for your time.
I haven't seen any examples of this sort of functionality – but it doesn't seem like it would be hard to cobble it together (famous last words...)
You have your representations in the UI of the remote files and those are enabled to be "dragged" to the desktop.
You catch the target destination when the user drags one of those representations
You start a download of the associated file and save it to the target destination
At least that is how I would start to approach it.
There are various electron related libs dealing with downloads (e.g. electron-dl). If you get this working, report back and share the details.