Alpha Video Training
Results 1 to 14 of 14

Thread: Problems Opening Files From Non-Alpha 5 Folders

  1. #1
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Problems Opening Files From Non-Alpha 5 Folders

    Hi guys,
    I've finally got my Alpha 5 website up live for beta testing. I've been having a problem that I can't figure out and it seems to happen with all types of files.

    My database contains a file location and I want a user to be able to open that file to view it. The problem is that if I set up a button to do it or make that field in the grid a link I get the same result. It works on my computer in preview, but not when I'm running live off of the app server over the web. This is kind of maddening because since it worked on my computer I thought all this stuff would work, the previews can be very deceiving this way.

    Here's an example:
    My DB contains this file location: \\DNCSERVER\machine\CL150\232-D-OP1-214
    This location is on a different server than the one with Alpha 5 installed.

    It works fine when I click a button to this link or the link itself in Working Preview. I get a web browser window with the file open in it. When I try it running the web app it doesn't do anything. I can copy and paste the link into the browser and it works fine. It doesn't seem to matter what file type.

    There has to be a setting somewhere that I'm missing, please help me get this working.

    Thanks!

    ETA: I should add that if I instead make a button to DOWNLOAD the file, that works fine.
    Last edited by -Jinx-; 10-08-2012 at 11:33 AM. Reason: addition

  2. #2
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    We might need to see how you are trying to open the file, what is under your button. But the physical address you show would ONLY be available inside your firewall if you were trying to open it up directly in the browser. E.g., it would be meaningless if I tried to open that in my browser address here in my office.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  3. #3
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Hi Steve,
    Yes, you're right; it would be meaningless for anyone else to try to open it. It's on another server in our LAN. When users access my alpha 5 web app off site they will be doing so through a VPN.

    I've got a button set up to run the action javascript: "open an .a5wpage, static HTML page, URL, or PDF document..." The page URL in the setup for the action javascript is "file:///{filename}" (I've tried this a few different ways). This button works perfectly in Live Preview or Working Preview but just pops up with a blank window when I'm running it live. I've tried other external websites and it works. I've even tried using our intranet site http://www3.companyname.com That works too. It just won't open up a file running live.

    ETA: It does NOT come up with a "this page cannot be displayed". It is a blank window.

    Also I can log onto the server running the application server and type "\\DNCSERVER\machine\CL150\232-D-OP1-214" into internet explorer. It pulls up the file just fine.
    Last edited by -Jinx-; 10-08-2012 at 12:42 PM.

  4. #4
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Use response.sendfile() instead. Here is an A5W page that I call just like you are doing. The page takes parameters location and filename.


    dim location as c
    dim filename as c
    dim path as c

    select
    case location = "A5Folder"
    path = "\a5\\"
    case location = "Webroot"
    path = filename_decode(Request.ApplicationRoot)
    case location = "Data"
    path = filename_decode("[PathAlias.ADB_Path]\\")
    end select

    openfile = path + filename

    if file.exists(openfile) = .f.
    ?"<script>alert('File not found');</script>"
    else
    response.sendfile(openfile,.t.)
    end if
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  5. #5
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Quote Originally Posted by Steve Wood View Post
    Use response.sendfile() instead. Here is an A5W page that I call just like you are doing. The page takes parameters location and filename.
    Steve,

    I'm sorry but your suggestion is beyond me at the moment. You'd have to explain it in detail...where to put it, how to get the file location from the grid to the a5w page...etc.

    Please take no offense because I don't mean any, but every time I ask a question on this forum I seem to get a response to do custom code. I bought this software so I wouldn't have to code and this is a simple thing that Alpha should do. There's nothing code worthy about this problem. Is this a bug or is there something stupid that I'm doing that isn't working right? Aren't there some kind of tests I can do to locate the issue?

    Once again, if I make a button to DOWNLOAD the file it will work; even running it live, however it won't OPEN it in a window, tab, or seperate browser window except in Working Preview or Live Preview.

  6. #6
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    I cannot make it work from a live website either. Someone else is going to have to comment about how or if the file:/// syntax works online, I am not an expert with that syntax. But you should also try turning off security on your web app and try again. If that makes it work, then visit the web project control panel and find Web Security > Page Security and make sure your file type is in the File types always allowed, and publish. Although the most common web file types are always allowed (htm, a5w, pdf, etc), others are automatically prohibited as a default and have to be allowed.

    Back to my method, take the code in my previous post and place it in an A5W page. Then call that page from your button with a URL such as in my attached image. In my example I have a "location" parameter, but you can hard code that on the A5W page if the filename always includes the full path. You can see that my A5W page code deals with the possibility that the file is not found whereas your simple file:/// does not take that into account.

    Finally, the reason the File Download utility you mentioned works is because Alpha has written the code for you. There is no File Open utility, so that is the reason you might have to write some code in this case. I know it is a hallmark of Alpha's advertising, but it is unlikely you can write a custom web application without writing some code.
    Attached Images Attached Images
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  7. #7
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Thanks Steve,

    I'm trying your solution now but the first time I tried it I get a "file not found" error which is probably the one in your code then this pops up in my Window:
    Code:
    dim location as c dim filename as c dim path as c select case location = "A5Folder" path = "\a5\\" case location = "Webroot" path = filename_decode(Request.ApplicationRoot) case location = "Data" path = filename_decode("[PathAlias.ADB_Path]\\") end select openfile = path + filename if file.exists(openfile) = .f. ?"" else response.sendfile(openfile,.t.) end if
    I've probably got something screwed up but I'm not sure where yet. I'll keep trying. I think that since I have a full path I should simplify the code you provided but that will take me some time to figure out.

    ETA: All I really need is filename...mine is the complete path with the filename.

    P.S. I've got security set to allow all file types while I'm messing with this.
    Last edited by -Jinx-; 10-08-2012 at 03:41 PM. Reason: addition

  8. #8
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    OK, I figured out that I had to put the code inside of this:
    Code:
     <%a5 ... %>
    Correct? When I tried it written inbetween those tags with a simplified version of your code it kind of works. It asks me if I want to open or save the file. That is the same thing as when I make it download a file. It doesn't appear to work any differently except it makes the popup window and nothing goes into the window. After you open it or save it, the window stays up with nothing in it. If I ask it to open a new browser window the button doesn't do anything at all.

    Idealy, I'd like to open my file in a popup window or another pane in my tabbed ui.

  9. #9
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Since you know your path you can simplify your code to below. Also see attached, I confirmed you can use // syntax to find files. Now, the reason I force a path (choice of three - webroot, data folder or c:\a5 folder) is I do not want the user to have full access to the entire server/LAN!

    dim filename as c

    if file.exists(filename) = .f.
    ?"<script>alert('File not found');</script>"
    else
    response.sendfile(filename,.t.)
    end if
    Attached Images Attached Images
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  10. #10
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    <<I'd like to open my file in a popup window or another pane in my tabbed ui>> You can control that in the onClick options, tell it to open the tabbedui or page. I happened to choose a DIV in my example.

    I dont really have an answer for the "prompt to save" problem. I actually asked that question about a month ago and here is the response. I have the same problem as you in this regard:

    The issue here is that the only way to set the name of the file being downloaded is to prompt to save. There is no way in HTTP to specify the filename without the save prompt, as it is done with the same HTTP header. This means that if you request download.a5w and it does not prompt to save, the correct content will be sent, but if the browser is configured to save automatically, it will typically use download.a5w as the file name. IE however considers the MIME type when saving the file and will use the expected file extension.

    In summary, if you want to control the name of the file when it is saved, you must prompt to save.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  11. #11
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Thanks again Steve,

    Unfortunately, it acts just like a download. I tried having it open a new browser window or a DIV but then the button doesn't work at all. If I have it go to a popup window it works as a download but leaves the window sitting there with nothing in it. What I ended up doing was using the shortened version of your code and told it to open a dropdown window. I sized the dropdown window to 1px x 1px so you can barely notice it on the screen and since it's a dropdown, it goes away when a user clicks again. With your help and the workaround I am now able to fix a different problem....The file download doesn't work when a file doesn't have an extension. your code and my dropdown window workaround does work for files without extensions.

    Once again, thanks for the help. Although it's not what I'd like, it's working at least. It sure would be nice to know why stuff works in the previews but not live....even when you can enter the exact same // syntax in your browser to call up the files.

  12. #12
    Member pettechservices's Avatar
    Real Name
    Chris Sutton
    Join Date
    Apr 2012
    Location
    Southern New Jersey
    Posts
    388

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Did you try a different browser by chance or a different computer to test it?

  13. #13
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    Quote Originally Posted by pettechservices View Post
    Did you try a different browser by chance or a different computer to test it?
    Yes and yes. Even had someone try with safari.

  14. #14
    Member pettechservices's Avatar
    Real Name
    Chris Sutton
    Join Date
    Apr 2012
    Location
    Southern New Jersey
    Posts
    388

    Default Re: Problems Opening Files From Non-Alpha 5 Folders

    What if you view source, do you see any information in there? Did you submit a bug report to Alpha, as it could be a bug?

Similar Threads

  1. Alpha 5 and Foxit Reader problems opening attachments in Outlook
    By bigdogfreight in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 08-23-2012, 06:46 AM
  2. Opening Folders
    By peanut in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 01-27-2011, 03:18 PM
  3. Opening Alpha 8 Files in Access 2007
    By GOODQINC in forum Alpha Five Version 8
    Replies: 15
    Last Post: 08-15-2007, 12:29 AM
  4. Data files in different folders
    By Mike Vance in forum Archived Wishlist
    Replies: 1
    Last Post: 06-13-2005, 08:57 PM
  5. Application Updates to Different Folders problems
    By Mike Vance in forum Alpha Five Version 6
    Replies: 2
    Last Post: 01-10-2005, 10:37 PM

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
  •