Skip to content

Tag: php

upload image to my server directory and use the url

I am stuck and really don’t have any idea how can i do this. I want to upload an image to my server root directory. And then i want to use the url of that image. Like I want to use this url in a html page. Which will have no link with my website. anyone clicks that html file

Alternative for define array php

I’m looking for an alternative for define(‘name’, array) as using an array in define gives me this error: Constants may only evaluate to scalar values in … The array I’m mentioning contains strings only. Answer From php.net… The value of the constant; only scalar and null v…

PHP sessions don’t expire. Ever

I’m transferring my application to another server, but I have some issues with the PHP sessions that don’t seem to expire. In php.ini I’ve set: Cookies are enabled, of course. And still, after 5 minutes, if I refresh the page I’m still logged in. Even if I close the browser and reopen …

How to change the colors of xdebug output?

The red and yellow standard colors of xdebug can hurt your eyes after a few hours. http://www.designified.com/blog/article/76/restyling-xdebug-output describes how to replace the style with javascript requiring jquery. I was looking for a more straight forward way and finally found one. Answer The solution is…

Why would json_encode return an empty string

I have a simple php structure with 3 nested arrays. I do not use particular objects and I build myself the arrays with 2 nested loops. Here is a sample of the var_dump of the array I want to convert to Json. In another script I have a similar structure and json_encode works fine. So I don’t understand w…

Line endings in a form textarea

Morning, When you post a form which has a textarea, what line endings are used? rn, n or like local files does it depend on the OS? I am tryring to find an RFC or W3C spec or something, or is it different based on OS/browser? Got a link? eg Would it be or and is it a standard or