Should I use php serialization?
Is there a limit of file size to serialize? JPGs can go up to 10mb.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PHP sessions are limited by the memory usage limit of PHP. So 10mb would probably be ok, but…
I don’t think “session” is the correct choice to store a large binary data. Uploaded files goes to a temporary folder on the server and you can reach them for a while from that directory. So, if you need to reach that file later, you can simply store the temporary file path to the session.
Example code:
Then, when you need to copy that file to the real path, you can do something like:
You can also reach “type”, “size” and “error” items from $_SESSION[“uploaded_file”] if you need them.