1

I am making a html based CD autorun which I intend to package with TideSDK. Everything works fine,the only issue I am facing is when someone clicks on a file download link(pdf,zip etc.) All the files open inside the application window and since the webkit engine doesn't understand the file types(e.g.,zip file) it shows strange characters instead of downloading the file.

So I want to know how should I force downloading of a file so that the user can save it in his system or open it with the associated application.

I am making the app for windows based systems.

Thanks in advance to all those who take out time to reply :)

Amit Kumar Jha
  • 599
  • 2
  • 8
  • 18
  • Hello, i am having the same question (i need the user to be able to open downloaded PDF,Powerpoint, .. files) and am wondering if you have found a solution to your problem. If so, could you explain me how you did it and provide links to the documentation? – user1574041 Feb 21 '13 at 09:09
  • Hey, i couldn't get it to work. I was short on time so i wrapped created a VB6 winform app and used the web browser control. – Amit Kumar Jha Feb 22 '13 at 16:13

2 Answers2

1

The mimetype would have to be changed to "application/octet-stream" which is easy to do on a normal server. However, as far as I know, there is no way to add mimetypes to TideSDK easily. I haven't tested this, but it may be possible to use something like PHP inside of tide and set the mime type from PHP. See this post for reference. Hopefully that helps.

Community
  • 1
  • 1
David M.
  • 773
  • 4
  • 13
1

We used the Ti.Platform.openApplication() method to open a file with an external application, i don't know if it's exactly what you need, but you could give a try. Here is the official doc: http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.Platform-method-openApplication

We are using it like this:

path = Ti.Filesystem.getFile(Ti.Filesystem.getApplicationDataDirectory().nativePath(), 'contents', @get('pdf_path'))
Ti.Platform.openApplication(path.nativePath())

to open a pdf document with an external application.

mat_jack1
  • 1,712
  • 1
  • 14
  • 15
  • Hey Mat, I tried this method but it didn't do anything, when I opened the console it showed error "openApplication failed: access denied". I think this is the method I am looking for, can you help out on this error? thanks a lot for replying. – Amit Kumar Jha Jul 01 '13 at 09:45