Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 607063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:19:12+00:00 2026-05-13T17:19:12+00:00

BACKGROUND: I have built a web application for a client which allows them to

  • 0

BACKGROUND:

I have built a web application for a client which allows them to save excel files to the server.

When I first built the application I stored these files in an uploads folder and linked to them directly from pages within the application (eg File).

On reflection this wasn’t very secure so I changed the uploader file to store the files above the web root and thereby prevent direct access.

I deliver the files back to the user by way of a php ‘retriever’ file (eg File). The file (after some user authentication checks) looks like this:

header("Content-type: application/octet-stream");
$_file = $_GET['filename'];
$sPattern = '/\s*/m';
$sReplace = '';

$_strippedfile = preg_replace( $sPattern, $sReplace, $_file );
header("Content-Disposition: attachment; filename=".$_strippedfile."");
echo file_get_contents('/var/www/uploads/'.$_file);

PROBLEM:

The above all works fine unless the user chooses to ‘open’ rather than ‘save’ in internet explorer. Excel attempts to open the file and throws ‘…could not be found. Check the spelling of the file name, and verify that the file location is correct’.

I’ve googled that error and it appears that it’s to do with the length of the filename (including the path). Unfortunately the path to temporary internet files is out of my control so was wondering if there was a way to force the user to save the file rather than open it? [Apparently this can be configured locally but a) my clients aren’t very technical and b) because they’re on a corporate network all admin rights are tied down.]

Any other ideas welcomed.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:19:12+00:00Added an answer on May 13, 2026 at 5:19 pm

    You can prevent Open of files in IE8 by sending the header

    X-Download-Options: noopen

    In earlier versions, you need to add a DOWNLOADOPTIONS meta tag to the page that contains the XLS file.

    But it seems likely that the problem you’re hitting has nothing to do with the length of the filename and everything to do with the caching headers on the response. You need to make sure that your file is marked as cacheable (e.g. Cache-Control: private) especially if you’re using HTTPS. See Download file over HTTPS in IE 5.5 / IIS 5.0 for further discussion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I have two lists, the first is items which contains around 250 tuples,
First Some Background I'm planning out the architecture for a new PHP web application
Background: I have a built-in-house custom SharePoint 2010 web part, inheriting from System.Web.UI.WebControls.WebParts.WebPart ,
I have a web-application built with GWT (2.0.3) and run on Apache Tomcat 6.
Background : I have a few different threads which each need to write to
Background: We have a TFS server setup where me manage our source code and
I've built a Django web application and some Django-Piston services. Using a web interface
I have a Silverlight application I built with the create webpage activated. When I
I have a working JNLP application which I need to distribute to various non-technical
Background: I have a website that has been built with ASP.NET 2.0 and is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.