3

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

5
  • So, to clarify, the current app works directly with the file on the local machine? As in, you're not attempting to upload and work with files on a remote server or through API calls to the server on the file? Commented Jan 30, 2015 at 3:48
  • Hi JasCav, yeah works with the file on the local machine. They will have a link in the application e.g. c:\MyTxt.txt . When they click print or open (this is a very basic example, we do more with it) it opens the document using System.IO.FileStream. Commented Jan 30, 2015 at 4:01
  • So, I don't know if this will get you in the right direction, but Spencer Cooley has an interesting blog post highlighting how one might create an image editor in a browser without making round trips to the server. It may be similar to what you're attempting to do. scotch.io/tutorials/… Commented Jan 30, 2015 at 4:17
  • you might find a single-flavor hack, but it would be better to use something more formal like node+webkit, cordova, or even HTA. Commented Feb 8, 2015 at 4:05
  • I remember having this problem long time ago and I also remember that I googled that and found some sort of flash object, which gave me the access point to the disk. Not a direct help, but try to search for this maybe. Commented Feb 8, 2015 at 10:22

5 Answers 5

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

1

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.

Comments

0

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/

5 Comments

Yeah thats the reason we are currently looking at the migration because chrome is dropping support for npapi. So the plugin option for it isnt going to fly.
If your code base is already in .net, you could simply create a client application with a GUI front end and still send queries to the server.
This rolls us back into the winforms/wpf days which gave us deployment nightmares. For all the crap that silverlight gets it makes deployment of LOB's a lot easier.
I agree, that's the greatest advantage at using web apps, no need to deploy. Still, Microsoft did make some improvements to ClickOnce which enable automatic update almost by default.
We went down the clickonce path for a few things but it never seemed as seamless as SL deployment. But could talk about that for hours. Thanks for your input.
0
+50

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.