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.... -
header("Content-disposition: attachment; filename=".$fileName);
-
header("Content-type: application/octet-stream");
-
header("Pragma: no-cache");
-
header("Expires: 0");
-
-
$fp = fopen("$fileLoc","r");
-
$str = fread($fp, filesize($fileLoc));
-
echo $str;
-
fclose($fp);
-
7 2024 pbmods 5,821
Recognized Expert Expert
Heya, h3lp.
Try this: -
header("Content-type: application/force-download");
-
Hi pbmods,
I've tried ur code, but it still can't work.
Safari still downloads the PHP script :(
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)
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
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
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().
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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
|
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...
|
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.
| |
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
|
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...
|
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...
|
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,...
|
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...
|
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...
| |
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,...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |