How to preview other content types in titanium desktop - html

I am using titanium to build a desktop application. They are a couple of times I need to download an excel file (or any other content type).
I am expecting it to open a file chooser dialog so I choose a folder to save it in. Instead it displays the content of the excel file in the desktop window which is not very useful.
I am able to view PDF files correctly in the desktop window.
How do I download regular files from titanium.

I may be wrong here, but I don't think you can control this behavior. This is based on each client machine that is using your application and their specific settings. Maybe this forum will help.
It may also depend on the content headers of the source of your file. If you need a reference for how a web application can be configured to force a download, see here. While this is based on a web app, the same MIME type rules apply.

Related

Open file after saving to local in flex web application

I have web application in which there datgrid inside there on last column there is pdf icon. On click of that i get pdf file byte array.
Now, i want to open that pdf in pdf reader/viewer at client side.
For that i have downloaded it as pdf like:
var fR:FileReference = new FileReference();
fR.save(byteArray,"test.pdf");
But, i can't open that pdf in inside viewer. I have searched lots of things but didn't get any solution for that.
My aim is to open pdf file at client side from bytearray which got in response.
Any help would be greatly appreciated.
But, i can't open that pdf in inside viewer.
I'm glad you can't. Otherwise, every flash file that's running on a website could start applications on my computer and wreak havoc.
Your intentions may be good, but those of others aren't. That's why security policies and sandboxes are in place.
If you want that kind of access to a client computer, you should build a desktop application with Air.
In the Flash Player you can't open the PDF from a ByteArray response. What you can do is have your server respond with an actual PDF document and navigate the user's browser to the PDF URL using navigateToURL(). This is up to the client's browser, but in many cases the browser will allow the user to view the PDF or open the PDF in a viewer app.

Is it possible to access and list files of local system in web browser.

My requirement is to show a panel where I list the local system directory, from where I drag and drop the files inorder to perform operations on it.
In HTML5 the FileSystem API is available , but most of the browsers are not supporting.
Is it possible by using input type as file? Like we browse and select a directory, then we can see the list of files and their details?
As the previous commenters correctly noted, this is not possible because it is considered a security hole. Think about a malicious script that could read out everything on your local file system just by visiting a web page.
You can however implement file drag-and-drop like this: https://github.com/moxiecode/plupload

Abobe Air/Flex 4.6 Remote File Viewer

I have a Air/Flex desktop application and I'm trying to create a component within the app that can view files on the web server is is already connected to. It just needs to access one particular folder that will contain PDFs, Images & Word documents. I also want the ability to click on the files and having them open in their default desktop applications.
Is this possible and how would I go about doing this?
It's possible but not with your Flex/AIR app alone. It cannot view files/directories on server by itself but it can communicate with your server via webservices, AMF, or any other back end based service. Typically the back end reads the folder and send this information to your app. Your app can open those files in corresponding app but only if those files are available on disk so your app will have to download them prior to opening them.
Every Application has different needs but I myself usually save anything to a desktop or you can use the App storage container as well. As I use only the desktop I download what is needed OR been asked for, and the visitor has the choice of keeping it or if not needed it gets automatically deleted! this way you can use whatever PDFs, Word, Images etc. use read and write (re-write) as well as creating PDFs on the fly with Images, text etc, and that way a visitor also can print directly at his or her own leisure. regards aktell

How HTML file upload works?

HTML uses form to send data to web server. The data can be included in the url parameters or embedded in HTML Request body. But for a file, I don't know how it works. I want to know this because I see some difference between uploading file on web and desktop applications.
The desktop application usually provides a text box to allow the user input the locale path of the file. But for web applications, the text box is usually read only.It displays the file path when the file gets selected with the browse button. Is that just a design issue between desktop and web?
Question is a bit unclear, but one important aspect about web applications (or HTML forms) is that they are sandboxed and cannot access local files directly. So the file upload picker does not allow direct input of the file name (which might be scripted), but only selection through an OS (or browser) supplied file choose UI (that the app or page cannot mess with).
Once the user has selected the file the page can access it, but it cannot make the selection itself (or surreptitiously).
A recent trend is to lock down desktop apps in the same manner. See for example Apple's sandboxing restrictions, that also do not allow apps to open random files without user intervention.
Is that just a design issue between desktop and web?
The implementation of a file upload form, whether desktop or web, is largely unimportant to the end result. Both desktop and web controls can utilize either a path string or a full-blown file navigator, though a desktop app is more likely to vary in its implementation. The only other difference is the destination: desktop apps tend to parse the file in memory and render it somehow, while web apps almost invariably upload it to a server (though this is subject to change: see the HTML5 file API), which then further operates on it.

How would I go about developing a file handler for Chrome and/or Chromium?

I would like to develop a browser plugin/extension (I'm not sure how they differ) for a particular (possibly new) file type. To be very explicit, I would like to visit a file, "foo.org", using my browser in something like Drop Box or Google Drive and have the browser treat the file as Emacs would treat an org-mode file. Eventually I would like to develop a full Emacs plugin/extension and be able to configure the browser to handle files with this plugin/extension based on the file extension or a file grokking heuristic.
Any solution that I develop will allow the editing to take place directly in the browser's tab area, i.e. a seamless solution (as opposed the useful but seamy Edit with Emacs solution referenced below). In the same way that Chrome recognizes a spreadsheet or word document and invokes the appropriate Google Docs tool, I would like to get an Emacs-lite editor handle the foo.org file. Another way to ask the question is: how do Google Docs tools get invoked within Chrome and perform the associated editing task. And are these tools open source?
You should consider building on Ymacs which is an Emacs-like editor in the browser.
For browser extensions, there is an experimental downloads api. However, it doesn't let you monitor downloads at the moment. This is planned for the future:
In the future, you will also be able to monitor and manipulate downloads.
However, you can probably just use some JavaScript and replace all links to *.org files with links that open in a tab running Ymacs. This should have the same effect--clicking a *.org link will open it in a new tab.
Take a look at content scripts and the tab api for documentation on how to inject a script into every page and how to open new tabs.
Take a look at Edit with Emacs , it should help you get (at least) part of the way there.