Hey Sitepointers,
Can anyone out there shed some light on how I can access the session upload progress variables?
I have this script here that uploads a file.
<?php session_start();
set_time_limit('3600');
if ($_FILES)
{
print_r($_FILES['uploaded_video']);
file_put_contents('/var/www/html/video-test/uploads/' . $_FILES["uploaded_video"]["name"],file_get_contents($_FILES['uploaded_video']['tmp_name']));
echo 'file uploaded';
}
?>
<form method="POST" action="upload.php" enctype="multipart/form-data">
<input type="file" name="uploaded_video" />
<input type="submit" value="Upload" />
</form>
And this other script that I’m trying to use to see uploaded progress
<?php session_start();
print_r($_SESSION);
$key = ini_get("session.upload_progress.prefix") . $_POST[ini_get("session.upload_progress.name")];
var_dump($_SESSION[$key]);
?>
And here is the output of that script while the file is uploading
Array
(
)
Notice: Undefined index: PHP_SESSION_UPLOAD_PROGRESS in /var/www/html/video-test/upload_progress.php on line 5
Notice: Undefined index: upload_progress_ in /var/www/html/video-test/upload_progress.php on line 6
NULL
What am I doing wrong here?
Also here is the session information from phpinfo()
session
Session Support enabled
Registered save handlers files user
Registered serializer handlers php_serialize php php_binary wddx
DirectiveLocal ValueMaster Value
session.auto_startOffOff
session.cache_expire180180
session.cache_limiternocachenocache
session.cookie_domainno valueno value
session.cookie_httponlyOffOff
session.cookie_lifetime00
session.cookie_path//
session.cookie_secureOffOff
session.entropy_file/dev/urandom/dev/urandom
session.entropy_length3232
session.gc_divisor10001000
session.gc_maxlifetime14401440
session.gc_probability00
session.hash_bits_per_character55
session.hash_function00
session.namePHPSESSIDPHPSESSID
session.referer_checkno valueno value
session.save_handlerfilesfiles
session.save_path/var/lib/php5/var/lib/php5
session.serialize_handlerphpphp
session.upload_progress.cleanupOnOn
session.upload_progress.enabledOnOn
session.upload_progress.freq1%1%
session.upload_progress.min_freq11
session.upload_progress.namePHP_SESSION_UPLOAD_PROGRESSPHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefixupload_progress_upload_progress_
session.use_cookiesOnOn
session.use_only_cookiesOnOn
session.use_strict_modeOffOff
session.use_trans_sid00