SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Weird Situation

  1. #1
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Weird Situation

    Hey guys - we've got a page that people select a file from a drop down box. The value of each option is the file's id. When they submit the form with the 'view' selection selected and a file selected it processes to a PHP page that decides what to do. If we have it set so that the php page sends a header to a php file which takes a file ID and finds out everything about it and then presents it to download or opens the file depending on what the mimetype is, then if the browser cant open it, we get a download box for the file. if it can, it opens the file in the current window. This works great but the only thing is, if the file CAN be opened by the browser, then we want it to open the file in a new window. We've tried having it so that instead of sending it directly to the PHP page to process the fileid, it sends it to the page where they pick the file except with an added var which tells the page to use javascript to open the PHP page in a new window so that if it is viewable , it is opened in a new window. The only problem with this is the fact that if the file CANNOT be opened by the browser, it doesnt give us a download box to download it. instead, it tells us that the page cannot be found (ie. the page page.php?file=34 cannot be found) in an alert box. So we have no idea whats going on. We need a way to make the file popup in a new window if it can be viewed. and if not, then it needs to popup the file download box. We have this working, except for the popping up a new window if it can be viewed. Right now, it just opens the file in the current window.

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sounds like you're on to your solution, it just needs to be tweaked. So instead of reinventing the wheel, why don't you post the javascript portion of the php.

    Is this for FileTrack again?

    Aaron
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it was. We found a nice-working solution and everything works great. If you'd like to see how it works, take a look at [Advisor Edit: Link Removed. Jason, you know the rules about self promotion and self-linking. The rules still apply] in the Manage File section.
    Last edited by Sketch; Mar 1, 2003 at 17:14.


Bookmarks

Posting Permissions

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