Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

MIME type for xlsx in IE and Edge

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MIME type for xlsx in IE and Edge

    We have a growing number of clients using MS Edge and Internet Explorer version 11. Just the way it is now. And, we need to be able to provide .xlsx downloads, but the MS browsers are just receiving an unusable .zip file instead.

    So, from what I can find, the solution is to add this to the MIMETypes.xml:

    Code:
    <mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
    But, that makes no difference.

    Anyone know what does work?
    Last edited by Steve Workings; 08-22-2018, 11:11 PM.
    -Steve
    sigpic

    #2
    Re: MIME type for xlsx in IE and Edge

    Originally posted by Steve Workings View Post
    We have a growing number of clients using MS Edge and Internet Explorer version 11. Just the way it is now. And, we need to be able to provide .xlsx downloads, but the MS browsers are just receiving an unusable .zip file instead.

    So, from what I can find, the solution is to add this to the MIMETypes.xml:

    Code:
    <mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
    But, that makes no difference.

    Anyone know what does work?
    i just tested a grid with an excel export feature and i ran it in edge. the excel file downloaded fine. i did not have to do anything special. how are you testing this?

    Comment


      #3
      Re: MIME type for xlsx in IE and Edge

      Thanks Selwyn. That's interesting - we do have some grids with Excel export on them that appear to work just fine, at least in Edge that I just tried. Much of what we have and what I've focused on is custom exports with file downloads:

      Code:
      . . .
      	'Get a Temp file name
      	dim filename as c = Request.GetRequestTempFileName("xlsx")
      	rs.ToExcel(filename)
      	
      	DIM FileKey as c = "UserList_" + dtos(date()) + "_.xlsx"
      	Session.SaveDataAsFile(FileKey,file.to_blob(filename))
      	myhost = Request.Host
      
      	URL = Session.FormatFileDataURL(filekey)
      
      	'Get the address of the session folder
      	Vadd = "https://"+myhost+"/" + URL
      
      	'Add the file address to the FN field for the download
      	e._set.fn.value = Vadd
      	
      	js = "{dialog.object}.runAction('DownloadUsers');"
      	js = js + "$svs('wait', '');"
      	Export_Users = js
      and then the Action Javascript download (yes, I just double-checked that .xlsx files are allowed for download):

      https://www.alphasoftware.com/alphaf...&thumb=1&stc=1
      Attached Files
      -Steve
      sigpic

      Comment


        #4
        Re: MIME type for xlsx in IE and Edge

        [was out for a couple days, picking this back up]

        So I decided to see what javascript is produced in a grid download vs. a file download of an .xlsx file.

        The grid download, that works, shows this message in the console:

        Code:
        Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
        and further examination shows it gets downloaded through the __A5FileDownload.a5w page.

        The file download (using the Action Javascript to download file) of the .xlsx document shows this in the console:

        Code:
        Resource interpreted as Document but transferred with MIME type application/x-zip-compressed:
        and then of course the action javascript used for file download.

        It would be nice to find a way to instruct the action javascript to simply download the file or change the MIME type. There may be a way and I'm headed in that direction next.

        I'd rather do that then have the more extensive code rewrite to push everything through the .a5w page. Either way it's looking like I'm going to have to edit something, but we have this in many places and I'm looking to simplify / reduce the work.
        Last edited by Steve Workings; 08-29-2018, 10:21 PM.
        -Steve
        sigpic

        Comment


          #5
          Re: MIME type for xlsx in IE and Edge

          Spending way too much time trying to re-write something just because the server handles an .xlsx differently in the file download than it does in the grid export. And still can't get the correct code.

          My best shot is this. And yes, ztable has a value, and the "EE" and "EE_DlgObj" objects exist.

          Code:
           . . .
          dim filename as c = Request.GetRequestTempFileName("xlsx")
          rs.ToExcel(filename)
          
          DIM FileKey as c = ztable + dtos(vdate) + ".xlsx"
          Session.SaveDataAsFile(FileKey,file.to_blob(filename))
          
          dim js as c = ""
          *concat(js, "var e = $('EE.__IFRAME1');" + crlf())
          *concat(js, "e.src = '__A5FileDownload.a5w?c=_a5filedownload&fileToDownload=" + filename + "&csfilename=" + FileKey + "&displayPermissionDeniedMsg=false';" + crlf())
          *concat(js, "EE_DlgObj.setVariables({});" + crlf())
          *concat(js, "EE_DlgObj._executeEvent('afterAjaxCallbackComplete',{" + crlf())
          *concat(js, "	ajaxEvent: 'GenericAjaxCallback'" + crlf())
          *concat(js, "} );;" + crlf())
          
          Myfunction = js
          I get nothing - not even an error in the console.
          Last edited by Steve Workings; 08-30-2018, 10:59 PM.
          -Steve
          sigpic

          Comment


            #6
            Re: MIME type for xlsx in IE and Edge

            I'm having trouble with this as well. Does your file exist on the web server? After I click file download, (and nothing happens), I can then browse to "https://"+myhost+"/" + URL and have the file appear in my browser...

            I've put together a test case to email in.

            Comment


              #7
              Re: MIME type for xlsx in IE and Edge

              Here's what Selwyn wrote back to me. I added the 'A5SessionFile__' string and it's working for me. (Still get the mime type warning, but at least the download works!)

              i have changed the comments we put into the prototype function to this;
              and I show the correct code for you function below in red.

              'Your code must set these properties in the e object:
              'e.ajaxCallBackType = "FileDownload"
              'e.fileToDownload = The name of the file to download

              'IMPORTANT: If e.fileToDownload is a temporary file, then you must first put the file into session storage and set the e.filetoDownload property to the key value you used for the session file.
              'VERY IMPORTANT: The key value must start with 'A5SessionFile__'
              'See example below

              'e.Folder = (optional) If e.filetodownload is a relative filename, the name of the folder where e.filetodownload is located
              'e.Action = (optional) 'Display Message' or 'Do nothing' - action to take if the file to download is not found
              'e.Message = (optional) The message to display to the user if the file to download is not found and e.Action is set to 'Display Message'
              'e.CSFilename = (optional) The default name for the file when the user is prompted to save the file on their computer. If you leave this blank then the default name is the same as e.filetodownload.
              'e.displayPermissionDeniedMsg (optional) (V12 and above only) - .t. or .f. - If permission was defined because the field did not match an allowed type, should a message be shown?

              'example - if the file to download is a temporary file
              '-----------------------------------------------------------------
              ''assume that the name of the file to download is in a variable called "FILENAME"
              ''generate the key value for the session file
              'dim sessionkey as c = "A5SessionFile__" + file.filename_parse(FILENAME,"NE")
              ''now save the temporary file to a session file with the sessionKey
              'Context.Session.SaveFileToSessionFile(FILENAME,sessionkey,.t.) '.t indicates that the file will be deleted after it is read
              ''now set e.filetodownload to the sessionKey
              'e.fileToDownload = sessionkey


              here is the correct code for your function (only the part that needs to changed is shown):

              ' Now move the file into session storage, so the user can download it
              if Context.Session.SaveFileToSessionFile(pdfOut,"A5SessionFile__" + checkName,.t.) then
              'File saved to session
              e.filetodownload = "A5SessionFile__" + checkName
              else
              'File not saved
              e.action = "DisplayMessage"
              e.message= "File Failed to be saved to session"
              end if

              Comment


                #8
                Re: MIME type for xlsx in IE and Edge

                Are you succeeding with IE, Edge, or both? I still can't get this right.

                Thanks

                Code:
                . . .
                dim filename as c = Request.GetRequestTempFileName("xlsx")
                rs = cn.ResultSet
                rs.ToExcel(filename)
                
                dim sessionkey as c = "A5SessionFile__" + file.filename_parse(FileName,"NE")
                Context.Session.SaveFileToSessionFile(FileName,sessionkey,.t.) 
                e.ajaxCallBackType = "FileDownload"
                e.fileToDownload = sessionkey
                
                myhost = Request.Host
                URL = Session.FormatFileDataURL(sessionkey)
                Vadd = "https://"+myhost+"/" + URL
                Last edited by Steve Workings; 09-23-2018, 02:43 PM.
                -Steve
                sigpic

                Comment


                  #9
                  Re: MIME type for xlsx in IE and Edge

                  Yes. It's downloading in Edge at least.

                  I do think it's odd that there are two different ways to download the files though... the custom export and the file download should work the same way.

                  Comment


                    #10
                    Re: MIME type for xlsx in IE and Edge

                    they do

                    Comment


                      #11
                      Re: MIME type for xlsx in IE and Edge

                      For custom export, the documentation says to use the file object, (file.to_string, file.to_blob). The file download uses e.FileToDownload. (I'm sure it works the same way to download the actual file)

                      I seem to get much more consistent results using the custom export & the file object, so I try to use that as much as possible. It's just a bit difficult to use custom export when I only want to deal with a single row, rather than a set of search results.

                      Comment


                        #12
                        Re: MIME type for xlsx in IE and Edge

                        I dunno. I've looked for another couple hours, tried a bunch more things, and still can't find something that works. The code I show below works for a download in Chrome, but it still results in a winrar file with unusable contents in IE and Edge.
                        -Steve
                        sigpic

                        Comment

                        Working...
                        X