when you download a file from MEGA service, a web page to display a download progress bar will appear. After the bar reaches 100%, your browser will notify users to save the file into a selected folder. I know that Mega use HTML5 FileSystem API to do this (Download files like mega.co.nz ). However, i don't know when the file is completely downloaded into the sandboxed directory, how the browser's instructed to notify users about the download? Would you please answer my question? Thanks in advance.
By using either a[download], msSaveOrOpenBlob, or Adobe Flash SWF Filewriter, depending on which method is supported by the browser.
PS: MEGA doesn't always use HTML5 FileSystem API. They have various techniques that they use depending on the browser support. In Firefox 20+, for example, they will store the data temporarily to the IndexedDB storage, before triggering the a[download].
Related
We are currently looking at porting a enterprise silverlight application over to html5. The major roadblock that we have hit is the ability to open files from the user's local disk. Currently they have a document library which just links to files on their computer that they can open from within the app and view or print out. All that I read is that you can only access the local sandbox of the web app with the html5 file api's. We want to load these files from code.
Does anyone know of any workarounds to this?
Thanks
There is no way for html5 to access local file without user selection. But FSO: FileSystemObject works for IE and MAYBE could be regarded as a work around. But still there are some requirements to meet.
It is possible to use chrome's filesystem API to access files on a users local filesytem. So you'd have to be willing to make this a chrome only application.
Using java you can create a "Signed" applet which has access to the local filesystem. (if the applet is signed you can request filesystm permissions)
then there is a tutorial for accessing methods of your java code directly from javascript here: http://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html
you should be able to perform something similar from silverlight.
There is no workaround in pure HTML5/Javascript. You need the use of plugins, such as Java or Silverlight (maybe you shouldn't port it after all). As for workarounds, HTML5 gives you an easy way drag and drop multiple files that you could transfer on the server and then display back to your users. Another workaround would be to install a custom agent (a software with only a tray icon) that would send the information about the current user "document library" to server and then again, you could display it back to the user.
Note: I've heard somewhere that browsers will eventually stop supporting plugins. http://www.howtogeek.com/179213/why-browser-plug-ins-are-going-away-and-whats-replacing-them/
Ya, I agree with Markain. However, if you were to limit your audience solely to chrome users, I daresay, you would most likely use some of your users. If Huazhihao is right, then your number of leaving customers should decrease but users who regularly use firefox won't be happy. Overall, I think that this will not work. Otherwise, there would be too many websites that trashed your hard driver (or at least wherever you have the rights to edit/delete files). I think it would be best if your product was setup to synchronize the file whenever an internet connection was detected and a change was made to the file. That way the user would not need to visit the website whenever the file was uploaded. If this is some kind of an error file, then it would be most beneficial if you were to make a link in the application that when clicked, would upload the file to the website and the website were to do whatever was necessary. If this is a purely online thing, then I don't see what business you would have looking through other peoples' files =-). Hope I helped!
I have web application
and i have situation i need to download file (on button click) to certain path in the client
without the browser download dialog box
using chrome (in IE im using activex).
what is the simplest way to do it?
The file is small text file (xml).
I know i have to use external application (flash...)
but i didn't find any info about how to do it or if there is other way
(i prefer to avoid using flash because my knowledge in flash is very limited)
To my knowledge, the only things that you can download from a browser without the user's interaction (and without using plugins, add-ons, activex, applets, ...) are cookies and HTML5 local storage, otherwise that will be a very serious security problem if a website can download any content to the user's machine without his permission and to a certain path .
Even Flash, can not do that, you should always get the user's permission to download something except SharedObjects which are the Flash Player cookies (can be disabled as the browser's cookies).
For AIR, you can not use an AIR app in the browser.
Hope that can help.
Please hear me out before you start crying security issues.
This is for an intranet application, hence I have full range to install any plugins or change any security permissions to suit.
What I want is for them to go to a webpage and click a link to download a file, such as a Word Document. This gets transferred to local storage of some kind (sandboxed if need be) and then is opened in word as a regular file.
When they click save, JavaScript or something will pickup the file is saved or the program is no longer accessing it and can be actioned upon, such as uploading back up to the server.
Is there any way to do this. I have looked at IndexedDb, WebStorage, HTML5 FileSystem API but I am new to all and don't see a way to do this.
I am open to coding any needed plugins as long as you don't mention Flash. The main issue I am coming across is opening a file downloaded into some form of local browser and then opening it via a desktop application, e.g. Word.
Any help, greatly appreciated.
After much research the only way to do it is with a plugin. IndexedDB, FileSystem API or WebStorage can not access the local file system. Which is good.
Silverlight is a good option for intranet and .NET, which is what I have chosen to go with.
Silverlight 5 in full permissions with a file watcher. The file watcher can be accomplished with this method: Is there an alternative to accomplishing what the FileSystemWatcher does in Silverlight?
I want to allow a web site users to be able to download files from my site, but with the help of a client-side downloader with an ability to continue an interrupted download.
For example, I want to sent a person a file with a size of 30+ Meg. I want the user to have the best downloading experience, so I can't afford him downloading 25 Meg and then getting the download dropped due to the network problems on his side.
Therefore, I want to have a javascript downloader rendered on a download page, that will show the actual client-side file delivery, and when it is downloaded, to give an ability to a user to save the file.
Or is it not possible due to the fact that javascript won't be able to open a save file dialog and save to a file system?
I'm afraid that is not possible with JavaScript and that's why:
To continue downloading from the certain point you should send to the server the position number to start downloading from. And as JavaScript has no access to local file system, you can't get that position.
UPD: it seems that I was too hurrying with the reply.
The file size can be gotten using the HTML5 File API and after getting the file size you can pass it to the server which should support the partial downloading.
But anyway, after downloading another part of the file you should sew two pieces together in some way; standard web browser dialog will only suggest to overwrite the file.
UPD2: to work with files in some Internet Explorers you can use FileSystemObject:
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
I'd look into making a plugin or extension. Like those DownloadThemAll extensions for firefox and Google chrome. Another alternative would be to use Flash, either alone or integrating it with javascript like hinted here: http://www.communitymx.com/content/article.cfm?cid=0922A
I am trying to add resume functionality to html5 file uploader.
I need to be able to resume after browser was closed (and reopened) and I lost the file object, I do not want the user to drag/open the file again.
Until now I used java applet to do it but I was hoping to find an html5 solution for this problem.
I thought about saving the files in local storage but they are too big.
Is there a way to save only the file object the path or any other information that might help me reopen the file without asking the user to reopen the file?
You might want to try out Resumable.js - JavaScript Library Providing Multiple Simultaneous, Stable And Resumable Uploads Via The HTML5 File API (or its domain www.resumablejs.com).
Resumable. js a JavaScript library providing multiple simultaneous, stable and resumable uploads via the HTML5 File API.
The library is designed to introduce fault-tolerance into the upload of large files through HTTP. This is done by splitting each files into small chunks; whenever the upload of a chunk fails, uploading is retried until the procedure completes. This allows uploads to automatically resume uploading after a network connection is lost either locally or to the server. Additionally, it allows for users to pause and resume uploads without loosing state.
Resumable.js relies on the HTML5 File API and the ability to chunks files into smaller pieces. Currently, this means that support is limited to Firefox 4+ and Chrome 11+.
sorry, it is not possible. The link between the file and the browser, that you can access with javascript (the FileURL) is destroyed after closing the window (and for sure, when closing the browser). You could save the name of the file and the amounts/parts uploaded and request the user to upload that file again, continuing from where he left off, but not automatically, without the users consent.
/Edit: Why the negative votes? Please leave a comment so I know what I said wrong! The question is about how to resume an upload when the user closes the browser. And that isn't possible. It is possible to stop/resume an upload while the Browser remains open and connection is lost, but not when the user closes the browser (references are lost). You could however copy the file to a temporary filesystem and then resume upload from there but that needs user consent and its limited to the amount of space the user provisions you to use.
This is possible with newer browsers(Chrome, Firefox).
The youtube uploader is a good example.
http://support.google.com/youtube/bin/static.py?hl=en&topic=1719827&guide=1719823&page=guide.cs&answer=1672758
http://www.youtube.com/watch?v=L5ebSn9HgJ4
I'm not entirely sure how their implementation fully works, but it is possible.