Topic: index.php download in Safari

I have a problem when I log into my FTP server via web2ftp from any machine running Safari, and click on a file to download it.  Instead of downloading the file, a download box pops up and asks where to save the file 'index.php.'  If I instead click on the checkbox next to the file and use the 'download' button, the download works fine.  This error only happens in Safari, not in Firefox.  When I click on a file in Firefox, a box comes up to download that file.

I have replicated the error by visiting net2ftp.com and using the installation of net2ftp there, and I am having the same problems with the installation of net2ftp on my own server at www.max-qtrailers.com/upload. I get the same request to download the 'index.php' instead of the file I clicked on whether the file is a large or small file.  When I click on a folder, the script does what it is supposed to and browses to that folder - it is only clicking on files that is problematic.

You can replicate the error by visiting net2ftp.com from Safari and logging in to 'ftp.max-qtrailers.com' with the username 'temp' and the password 'temp.'
I tried logging into a public FTP site through net2ftp.com and still get the same problem.  I visited ftp.apple.com and logged in as anonymous.  I clicked on a file, and instead of downloading, it asked me to save the index.php.

Has anyone else run into this strange issue with Safari? 
Any ideas for a workaround, or a way to make files non-clickable to force users to use the checkbox and the 'download' button?  I have some very confused clients trying to download files from my website and getting the index.php instead!

Thanks for your help in advance!!!
- Jake Puffer

Re: index.php download in Safari

I have also experienced this.

Re: index.php download in Safari

Hello!

We have this problem, too. I've added some mime-types, which are missing (mp4, mpg, mpeg), because we use a ftp-Server for the transfer of video-files, but this doesn't solve the problem. This Safari-failure is a real problem.

Would this be fixed soon? Can I help, testing?

Greetings
Zodiac

Re: index.php download in Safari

Actually it downloads the file, but names it index.php.  If you rename the file it works just fine.

Check: http://www.net2ftp.org/forums/viewtopic.php?id=3083

I have not been able to test ths fix yet, but I believe that it should address the issue.

Last edited by leggmann (2008-01-08 22:59:09)

Re: index.php download in Safari

Ok here is the fix.  Will also post this under modifications.

//Safari Check
    if ($net2ftp_globals["browser_platform"] == "Mac"){
    header("Content-type: application/force-download");
    header("Content-Transfer-Encoding: Binary"); 
    header("Content-disposition: attachment; filename=\"".$filename_html."\"");
    header("Content-Description: $filename_html");
    header("Content-Length: $filesize"); 
    header("Connection: close");
    } //End If
    else {

This starts at line 3687 in my filesystem.inc.php file.  Make sure to close the else right before the closing bracket for the entire function.  Also instead of using browser_platform, you could use browser_agent, but I was unable to get my browscap to id Safari.  No worries though, as this works well under Mozilla anyway.

Re: index.php download in Safari

Hello leggmann!

You are great! It works perfectly!
The last three lines didn't have to be in the if/else-part, but thats not important.
This is so cool!
It works now in Firefox and Safari on a Mac. Great!

Many Thanks!

Re: index.php download in Safari

Hi!
My first post here.

I get "Internal server error" then I put this Safari fix in line 3687 in filesystem.inc.php. Can some one please give me more exact position.

Thanks
Micke

Re: index.php download in Safari

Thanks, leggmann!  You solved my problem!  I hope this is added to the newest realease of Net2FTP, so nobody else has to deal with the issue.
Great Job!
- Jake

Re: index.php download in Safari

I think it is not line 3697…

Perhaps it depends on the editor you are using for (I use TextWrangler on Mac) ?

Try line 3699.

Take care not duplicate twice "else {" at the end of the modifications

It's working for me but I wonder if the code is perfectly correct ?

http://telechargements.lesyeuxfertiles.eu/imagesforums/modif-net2ftp-safari.jpg

Last edited by zorglub (2008-06-23 12:20:25)

Re: index.php download in Safari

code is absolutely correct.

Re: index.php download in Safari

Cool! So usefull info. Thanks!

_______________________________________________

Download  keygen from this site.

Last edited by MrtreashHouse (2009-10-16 11:18:55)