473,800 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with save as at Safari for Windows

15 New Member
Hello, i have a PHP script that will pop up a save as dialog box.
This script works well at Firefox and IE7, but when i test it with Safari for Windows.
It will download the PHP script itself and not the file that i want to give to user.
Can someone help me, pls? Thanks in advance....
Expand|Select|Wrap|Line Numbers
  1.    header("Content-disposition: attachment; filename=".$fileName);
  2.    header("Content-type: application/octet-stream");
  3.    header("Pragma: no-cache");
  4.    header("Expires: 0");
  5.  
  6.    $fp = fopen("$fileLoc","r");
  7.    $str = fread($fp, filesize($fileLoc));
  8.    echo $str;
  9.    fclose($fp);
  10.  
Aug 3 '07 #1
7 2024
pbmods
5,821 Recognized Expert Expert
Heya, h3lp.

Try this:
Expand|Select|Wrap|Line Numbers
  1. header("Content-type: application/force-download");
  2.  
Aug 3 '07 #2
h3lp
15 New Member
Hi pbmods,
I've tried ur code, but it still can't work.
Safari still downloads the PHP script :(
Aug 3 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, h3lp.

Have a look at the comments on this page.

(p.s., you can use readfile() to output the entire file in one step)
Aug 3 '07 #4
h3lp
15 New Member
Sorry for the late reply, been busy for the last few days.
Wow, pbmods. That one is working ;)
Thanks a lot, really appreciate your help.
Thx, thx, thx :D
Aug 6 '07 #5
h3lp
15 New Member
Rrr, sorry pbmods.
One more thing, if i want to download a jpg image. Safari will automatically open the image, instead of pop up a save dialog box.
While Firefox & IE will ask user to download the jpg file.
Can you help me again, pls? Thx
Aug 6 '07 #6
pbmods
5,821 Recognized Expert Expert
Heya, H3lp.

Force-downloading an image file should use the same syntax as force-downloading any other file. If the browser insists on displaying the image, this might be a feature of the browser. Perhaps try zipping the file first.

Incidentally, you can use fread() to output the file directly without having to worry about fopen() and fclose().
Aug 6 '07 #7
nimeb
1 New Member
Hi,
Having the same problem with vb.net2003 also...
It saves the aspx page, instead of the excel i'm generating..
Can some one help?

Thanx
Nov 2 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
12352
by: Josh Renaud | last post by:
I'm still trying to solve a problem I have experienced in Safari. This is my third post on the subject. I'm hoping someone can shed some light. The problem is that, in Safari, a table with no specified width inside a containing div with a specified width seems to break out of that div when margins are applied to the table. It seems the table's width defaults to 100% of the parent div. But when I apply left and right margins to the...
3
2158
by: Roger Withnell | last post by:
My simple popup menu code works in IE (Windows and Mac) but not in Safari. I use a onmouseover ShowMenu function and a onmouseout HideMenu function. Because Safari, unlike IE, recognises (correctly) text nodes within the element nodes, the functions run twice as often. If the onmouseover is to or the onmouseout is to a text node then the functions return false and do nothing. But because so many functions are being triggered, if the...
17
1992
by: dejavue82 | last post by:
You'll see a render problem on http://www.asp.net when you access it with the Apple Safari browser. Anybody know why? This is a Microsoft site, shouldn't they know what they are doing? Regards, Jim Light
2
2119
by: Simon Wigzell | last post by:
I use onkeypress() within text fields in my forms to chcek certain characters e.g. allow numbers for a phone number or credit card field. The code looks at the key pressed and if it is not numberic it posts an alert and returns false. On everything I have looked at except safari on the mac, returning false to onkeypress() is enough that the newly typed character will not appear in the text field. On mac safari it does. Is there no way to...
34
3878
by: Simon Wigzell | last post by:
document...focus() will scroll the form to move the specified text field into view on everything I have tried it with except Safari on the MAC. The form doesn't move. Any work around? Thanks.
3
1556
by: Amir Michail | last post by:
Hi, I have bookmarklets with a # in their urls but safari changes the # to %23. And unfortunately, the bookmarklet does not work with %23. You need to change it back manually to #. Any workarounds? Amir
2
1554
by: Jeff | last post by:
Okay, I read that Safari is now available for Windows, so I downloaded it to test on a vb.net/visual web developer 2005 app. that I created. The app works fine in other browsers. While in safari, I get the error message below after hitting a button that simply redirects the user to another page. Searching google provides a number of people having prior problems, but no mention about Safari. The error is apparently related to a security...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.