It looks like you're new here. If you want to get involved, click one of these buttons!
Isn't it time to fix this one. It's been there since Flash 8 when you introduced the feature and this is a major showstopper for usage on sites that require login. The URLStream class doesn't seem to have any of these issues it retains cookies, basic authentication information and works over SSL.
'scriptData': {'PHPSESSID': '<?php echo session_id();?>'},
'scriptData': {'PHPSESSID': '<?php echo session_id();?>'},
<?php
/**
* @see Zend_Controller_Plugin_Abstract
*/
require_once 'Zend/Controller/Plugin/Abstract.php';
/**
* Controller plugin that restarts the session for Uploadify.swf calls
*/
class Application_Controller_Plugin_Uploadify extends Zend_Controller_Plugin_Abstract
{
/**
* PreDispatch Hook.
*
* Checks to see if the current request has been made by the Uploadify.swf file
* if so restart up the php session and continue on
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$phpSessId = $request->getParam('PHPSESSID');
if (!empty($phpSessId) && session_id() != $phpSessId) {
session_destroy();
session_id($phpSessId);
session_start();
}
}
}
'script' : '<?php echo $this->url(array('controller' => 'upload', 'action' => 'handle-file-upload')) ?>',
var start = document.cookie.indexOf(\"PHPSESSID=\");
var end = document.cookie.indexOf(\";\", start); // First ; after start
if (end == -1) end = document.cookie.length; // failed indexOf = -1
var cookie = document.cookie.substring(start+10, end);
$(\"#someid\").uploadify({
.
.
'script' : 'upload.php',
'scriptData' : { 'PHPSESSID': cookie },
.
.
});
session_id($_POST['PHPSESSID']);
session_start();
.
.
session_id($_POST['PHPSESSID']);
session_start();
echo \"cookie value : \" . $_COOKIE['mycookie'];
session_id($_POST['PHPSESSID']);
session_start();
$("#someid").uploadify({
'script' : 'uploadify.php',
'scriptData' : { 'PHPSESSID': '<?php echo(session_id()); ?>'},
});
<?php
session_start();
$id = session_id();
echo "<script language='JavaScript'>
$(document).ready( function () {
$('#file_upload').uploadify({
'uploader' : 'uploadify/uploadify.swf',
'script' : 'uploadify/uploadify.php',
'cancelImg' : 'uploadify/cancel.png',
'folder' : 'uploads',
'multi' : true,
'method' : 'post',
'scriptData' : { 'PHPSESSID': '".$id."'},
'auto' : true,
'fileExt' : '*.jpg;*.gif;*.png;*.php',
'fileDesc' : 'Image Files (.JPG, .GIF, .PNG, .PHP)',
'queueID' : 'custom-queue',
'queueSizeLimit' : 1,
'simUploadLimit' : 1,
'removeCompleted': false,
'onSelectOnce' : function(event,data) {
$('#status-message').text(data.filesSelected + ' files have been added to the queue.');
},
'onAllComplete' : function(event,data) {
$('#status-message').text(data.filesUploaded + ' fichiers envoyés, ' + data.errors + ' erreurs.');
}
});
});
</script>";
?>
<div class="upload">
<div id="status-message">Select some files to upload:</div>
<div id="custom-queue"></div>
<input id="file_upload" type="file" name="Filedata" />
</div>
<?php
$id = $_POST['PHPSESSID'];
session_id($id);
session_start();
?>