xsendfile sends a blank file
4 posts
• Page 1 of 1
xsendfile sends a blank file
I recently installed the xsendfile mod on my WAMP and had a similar issue until I added this to my htaccess:
Now I've downloaded Helicon Ape to run the same module on my IIS.
I have a simple .php script and a small .txt file for testing.
My php is as follows:
When I click on my xsendfile.php in my xsendfile directory, it brings up a windows browse box, I hit ok to download, and a testfile.txt IS downloaded. However it is always blank.
I added this to my httpd.conf in Helicon Ape Manager:
And then clicked on my default website in Helicon Ape Manager and added this to my .htaccess:
But I am still getting a blank file and not my correct .txt file. I have tried several relative directories etc to my code however, the following works perfectly on my WAMP:
Any help would be greatly appreciated.
Aravona
- Code: Select all
<IfModule mod_xsendfile.c>
XSendFile on
</IfModule>
Now I've downloaded Helicon Ape to run the same module on my IIS.
I have a simple .php script and a small .txt file for testing.
My php is as follows:
- Code: Select all
<?php
//We want to force a download box with the filename hello.txt
header('Content-Disposition: attachment;filename=testfile.txt');
header("Content-Type: application/force-download");
//File is located at /home/username/hello.txt
header('X-Sendfile: /inetpub/wwwroot/xsendfile/testfile.txt');
When I click on my xsendfile.php in my xsendfile directory, it brings up a windows browse box, I hit ok to download, and a testfile.txt IS downloaded. However it is always blank.
I added this to my httpd.conf in Helicon Ape Manager:
- Code: Select all
XSendFilePath c:/inetpub/wwwroot/xsendfile
And then clicked on my default website in Helicon Ape Manager and added this to my .htaccess:
- Code: Select all
<IfModule mod_xsendfile.c>
XSendFile on
</IfModule>
But I am still getting a blank file and not my correct .txt file. I have tried several relative directories etc to my code however, the following works perfectly on my WAMP:
- Code: Select all
header('X-Sendfile: /wamp/zxy/xsendfile/testfile.txt');
Any help would be greatly appreciated.
Aravona
Re: xsendfile sends a blank file
Hello, Aravona
Here are some suggestions:
- leave just
XSendFile on
instead of
<IfModule mod_xsendfile.c>
XSendFile on
</IfModule>
in .htaccess
- try to use Content-type known to IIS, for example
text/plain
- in the following line specify absolute path starting with C://...
header('X-Sendfile: /inetpub/wwwroot/xsendfile/testfile.txt');
- try to download the file directly as http://localhost/xsendfile/testfile.txt. Will it download fine?
Here are some suggestions:
- leave just
XSendFile on
instead of
<IfModule mod_xsendfile.c>
XSendFile on
</IfModule>
in .htaccess
- try to use Content-type known to IIS, for example
text/plain
- in the following line specify absolute path starting with C://...
header('X-Sendfile: /inetpub/wwwroot/xsendfile/testfile.txt');
- try to download the file directly as http://localhost/xsendfile/testfile.txt. Will it download fine?
Re: xsendfile sends a blank file
If I just leave 'XSendFile on' then it says 'page cannot load' and the file does not run, it only runs inside the ifmodule.
I have tried 'header('X-Sendfile: C:/inetpub/wwwroot/xsendfile/testfile.txt');' and 'header('X-Sendfile: C://inetpub/wwwroot/xsendfile/testfile.txt');' to no avail.
Also 'header("Content-Type: text/plain");' did not work either, still a blank file.
I can display my file from: http://localhost:81/xsendfile/testfile.txt (my IIS localhost) OR http://localhost/xsendfile/testfile.txt (my WAMP localhost) in my browser perfectly fine.
I have tried 'header('X-Sendfile: C:/inetpub/wwwroot/xsendfile/testfile.txt');' and 'header('X-Sendfile: C://inetpub/wwwroot/xsendfile/testfile.txt');' to no avail.
Also 'header("Content-Type: text/plain");' did not work either, still a blank file.
I can display my file from: http://localhost:81/xsendfile/testfile.txt (my IIS localhost) OR http://localhost/xsendfile/testfile.txt (my WAMP localhost) in my browser perfectly fine.
Re: xsendfile sends a blank file
Fixed it. Seemed to have been an issue with my fastcgi.
Incase anyone else has this issue try:
in your htaccess.
Incase anyone else has this issue try:
- Code: Select all
<Location /php-fcgi/php-cgi.exe>
Options +ExecCGI
SetHandler fastcgi-script
XSendFile On
</Location>
in your htaccess.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests