LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Internet Explorer not downloading files from linux server (https://www.linuxquestions.org/questions/linux-newbie-8/internet-explorer-not-downloading-files-from-linux-server-784988/)

pre07 01-27-2010 12:07 AM

Internet Explorer not downloading files from linux server
 
Hi

Please HELP, really urgent!!!!

i have a very simple php web application deployed on linux (centOS4) machine. It creates a file and stores the file in /tmp folder on my linux machine. The path for this file is specified in the href attribute of the link. Ideally when we click this link the download manager should pop up so that the file can be downloaded on client machine.
When i access this website remotely from my window xp machine on firefox it downloads the file properly but when i run on internet explorer (i have IE7 on my windows XP) and click the link, the download manager does'nt pop's up. even when i right-click that link and select save as, an error message pop's up saying "file path not found". possibly IE is not able to determine the linux file path.........so how do i work around this..........is there some specific way for specifying the linux file paths to be downloaded by IE?

worm5252 01-27-2010 04:56 PM

sounds like the php web app has a compatibility issue with IE. I would suggest starting by looking into if the php script works on IE. If it does then you can look into why IE can't find the file.

pentode 01-27-2010 05:57 PM

Try putting the file somewhere within your /var/www/ directory. IE may not like trying to look above the /www/ directory, if I understand what you are doing.

If you have an ftp server running on the Linux box, you might also try to access it via ftp in IE just to see if that works.

pre07 01-27-2010 11:11 PM

Hi

thanks for your reply, PHP does runs on IE and am creating my files within the /tmp folder on linux..........however i tried placing the files on the virtual directory (/apache/htdocs or as you said /var/www) and now it downloads the file......... but how can i go about downloading the files placed in /tmp directory.

btmiller 01-28-2010 12:27 AM

This has nothing to do with IE. By default Apache will not serve files outside the server root defined in the configuration file (think about it, do you want someone to be able to download /etc/passwd or other system files?). If you want users to be able to download things from /tmp, you have two choices: (1) create a symlink between a directory in /tmp and somewhere in your webroot, or (2) modify your Apache config to grant access to files in /tmp (actually you should probably do a subdirectory of /tmp since you probably don't want everything in /tmp accessible).

pre07 01-28-2010 11:07 PM

Hi btmiller

but mozilla is able to access the files kept in /tmp.How is it that apache only restricts IE from downloading file from /tmp directory on linux.

worm5252 01-28-2010 11:39 PM

Quote:

Originally Posted by pre07 (Post 3844426)
Hi btmiller

but mozilla is able to access the files kept in /tmp.How is it that apache only restricts IE from downloading file from /tmp directory on linux.

I have no clue here, but what btmiller says makes sense. Now that I understand what the PHP script is doing I get it. I would create a symlink in /var/www that points to /tmp and then update my PHP script to look at the symlink instead of /tmp.

I am not 100% on this so don't do it without someone else being able to confirm it, but wouldn't giving www-data access to /tmp not resolve this issue as well?

btmiller 01-29-2010 12:46 AM

You'd also need to add a <Directory> entry for /tmp and probably also an alias to the httpd.conf, e.g.:

Code:

Alias /tmp/ "/tmp"               
<Directory "/tmp">
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  allow from all
</Directory

Apache won't serve up a directory unless you allow it too (the user Apache is running as also does need read access to the directory and all the files within it, as worm5252 points out.

PHP operates entirely on the server side. That is, the PHP script is run by the web server on the server machine and spits out an HTML document that is transmitted back to the client. Compare this with Javascript, which run on the client browser. Apache and PHP work independently of the client browser, so I'm not sure why the OP doesn't have the problem with Mozilla unless there's some browser specific glitch in the HTML coding or something similar.

edit to add: It's probably a really bad idea to allow users to download stuff from /tmp, because any user (include the one Apache runs as) can write to it. This is a security vulnerability. If you must use /tmp, at least create a subdirectory with controlled access and only allow Apache to serve up the subdirectory.


All times are GMT -5. The time now is 07:47 PM.