I'm building a multi-page form with PHP. I'm storing most of the value's in $_SESSION. Using the following method...
$_SESSION['title'] = $_POST['title'];
It's working fine so far but I'm not sure if it will be able to hold PDFs, videos, ect.
Does the $_SESSION only hold strings & intigers, or can files be stored there?
The maximum size of a $_SESSION is the maximum memory allowed to a PHP script, but chances are if you even get to 1/3 of that, you're doing something wrong.
$_SESSION
, as a rule, should only be used to keep what information is needed by the user for the majority of the site page views. It is highly improbable, that you will actually need a file on each page.
Here's a better option, store a temp file on the disk and assign the path to the temp file in the $_SESSION
. Then, when you need it, read the file to the user.
I do not suggest you to store big value because this information is stored in your server. You should serialize a PHP object that will contain path to those file if you want to keep some reference to these files.
Edit:
The session is loaded into memory at run time, so in theory it's limited by the memory_limit
in php.ini.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With