Skip to content
Advertisement

Category: Questions

Convert a String to Variable

I’ve got a multidimensional associative array which includes an elements like I’ve got a strings like: How can I convert the strings into a variable to access the proper array element? This method will need to work across any array at any of the dimensions. Answer Quick and dirty: Of course the input string would need to be be sanitized

Serving large files with PHP

So I am trying to serve large files via a PHP script, they are not in a web accessible directory, so this is the best way I can figure to provide access to them. The only way I could think of off the …

$_POST vs. $_SERVER[‘REQUEST_METHOD’] == ‘POST’

Some guy called one of my Snipplr submissions “crap” because I used if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’) instead of if ($_POST) Checking the request method seems more correct to me because that’s what I really want to do. Is there some operational difference between the two or is this just a code clarity issue? Answer Well, they don’t do the same

HTTP Headers for File Downloads

I’ve written a PHP script that handles file downloads, determining which file is being requested and setting the proper HTTP headers to trigger the browser to actually download the file (rather than displaying it in the browser). I now have a problem where some users have reported certain files being identified incorrectly (so regardless of extension, the browser will consider

How to make PDF file downloadable in HTML link?

I am giving link of a pdf file on my web page for download, like below The problem is when user clicks on this link then If the user have installed Adobe Acrobat, then it opens the file in the same browser window in Adobe Reader. If the Adobe Acrobat is not installed then it pop-up to the user for

PHP: Cookie domain / subdomain control

I’m working on a site with multiple subdomains, some of which should get their own session. I think I’ve got it worked out, but have noticed something about cookie handling that I don’t understand. I don’t see anything in the docs that explains it, so thought I would see if anyone here has some light to shed on the question.

Advertisement