After 3 whole days of testing, researching and failing I need your help please on this one.
I have this HTML form
<form action="upload.php" method="POST" enctype="multipart/form-data" target="upload_target" >
<input type="hidden" name='<?php echo ini_get("session.upload_progress.name"); ?>"' value="myUploadProgress">
<input type="file" name="myfile" id="file1" style="display:none">
<button id="browse-button">Browse</button>
<input id="update-button" class="disabled" type="submit" name="submitBtn" value="Update" />
</form>
and I separated my php in to 2 steps:
upload.php - posting the form
<?php session_start(); getcwd().DIRECTORY_SEPARATOR; chdir('/tmp'); $destination_path = getcwd(); $result = 0; $target_path = $destination_path . '/' .basename( $_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $result = 1; } sleep(1); ?>
upload_status.php - fired by an ajax request on 1000ms interval
<?php print_r($_SESSION); ?>
for some reason I keep getting $_SESSION as empty and I expected to get $_SESSION["upload_progress_myUploadProgress"] (or something else) as array of vars of my current upload.
Things that I have checked and already in my php.ini
- file_uploads: On
- post_max_size: 2G
- upload_max_filesize: 2G
- output_buffering: off
- session.upload_progress.cleanup: On
- session.upload_progress.enabled: On
- session.upload_progress.freq: 1%
- session.upload_progress.min_freq: 1
- session.upload_progress.name: PHP_SESSION_UPLOAD_PROGRESS
- session.upload_progress.prefix: upload_progress_