www.webdeveloper.com
Results 1 to 7 of 7

Thread: Open document / file with it's own application

  1. #1
    Join Date
    Jul 2012
    Posts
    12

    Open document / file with it's own application

    Hi guys,
    my small project has a section where the admin uploads files to the localhost server. These files
    are then listed (using a foreach loop to display from db). I have done a link like: <a href ="..." > but I dont want the file to be open in the browser (in the case of images). or documents to be downladed.

    I'm wondering if (it is possible) or there's an easy way to make the file open in it's own default program, for example if i click on a file which is a .xls it opens in excell, a .jpg opens in windows image viewer, or a .pdf opens in adobe reader. it's a localhost so the files are very much in my pc Ibelieve it's easier than if it would be in a remote host.

    Any help will be much appreciated!

    Mike

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,432
    There's no way I know that you can force it from the server side. Depending on the browser and the user's settings, the user may have the default action for a particular file type to be to open it up in a specific application. But if you could force a given file to be opened by a given application, that would not only be beyond the scope of what a web app should do (IMO), but also a potential security risk.

    I would recommend just doing the usual sending of the file as an attachment, and leave it up to the user to open it in a relevant application if they choose to, save it as a file, or cancel the action if they aren't sure or don't trust the source.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2012
    Posts
    12
    Thanks for you quick response, However, there are no security risks because the only user is the same person owning the server, this is something i'm trying to do with PHP but to work as a desktop application although using the browser. As I said before, the user uploads files and add a category to it, so that files will keep organized. he then can see all the files in the folders listed and access each individual one. all this happening in the browser. So forgetting all the security issues, is it possible? if so, how?

    Thanks,

    Mike

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,432
    Are you running the app in question as a web app via a browser communicating with the server via HTTP? If so, then you are going to be constrained to the security considerations that would apply to any web app -- at least to the best of my knowledge. If you want access to the user's desktop, I would assume you'd need to run an actual desktop app (PHP-GTK, perhaps?) which might then interface with your web app on the server.

    But you are admittedly getting pretty well out of whatever my area of expertise is, so maybe someone has a better idea?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jul 2012
    Posts
    12
    Thanks for the advice, I'm having a look at PHP GTK2 , do you know of any good GTK tuts or forums to get started?

    Mike

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,432
    Quote Originally Posted by MikeSpider View Post
    Thanks for the advice, I'm having a look at PHP GTK2 , do you know of any good GTK tuts or forums to get started?

    Mike
    Nope. Like I said, about all I know about it is that it exists.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  7. #7
    Join Date
    Jul 2012
    Posts
    12
    Thanks any way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles