php_flag session.use_cookies off
php_flag session.use_trans_sid on
php_value session.name symfonyclass mySessionStorage extends sfSessionStorage
{
public function initialize($options = null)
{
if($this->transSidFor(sfContext::getInstance()->getRequest()))
{
$sessionName = isset($options['session_name']) ? $options['session_name'] : 'symfony' ;
if($value = sfContext::getInstance()->getRequest()->getParameter($sessionName))
{
if (sfConfig::get('sf_logging_enabled'))
{
sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Changing session name "%s" to "%s"', $sessionName, $value))));
}
session_name($sessionName);
session_id($value);
}
}
parent::initialize($options);
}
/**
* Checks if changing of session id is enabled for current module and action.
* Enabled pairs are set in "app_storage_trans_sid_for" array.
* - To enable specific action, add "moduleName/actionName".
* - To enable whole module add "moduleName".
* @return boolean
*/
private function transSidFor(sfWebRequest $request)
{
$for = sfConfig::get("app_storage_trans_sid_for");
if(!is_array($for) || !$for)
{
return false;
}
return in_array($request->getParameter("module"), $for) || in_array($request->getParameter("module")."/".$request->getParameter("action"), $for);
}
}
all:
storage:
class: mySessionStorage
param:
session_name: symfony storage:
trans_sid_for: ["myModule/upload", "myModule/fileCheck"] $("#fileUpload1").fileUpload({
'scriptData': {'<? echo ini_get('session.name') ?>':'<? echo session_id() ?>'},
'uploader': '<? echo public_path("myDir/uploader.swf") ?>',
'cancelImg': '<? echo public_path("myDir/close.png") ?>',
'script': '<? echo url_for("@my_route?action=upload") ?>',
'checkScript': '<? echo url_for("@my_route?action=fileCheck") ?>',
'folder': '/',
'multi': true,
'displayData': 'speed',
'simUploadLimit': 2
});
superpaul82 wrote: Hi! I use this plugin in my local machine, but when I try to upload files I receiver an IO Error..
I use the upload.php file providing by the plugin; is it correct?
Thanks
dyke.ecl wrote: disturbed Thank'u so much...I still got a problem with uploading files. The problem is IO Error #2038( typical problem for uploading files ). It's difficult to debug this kind of problem. I read somewhere that I can tour of mod_rewrite, but it isn't reasonable idea for me. How can I check, what the problem realy is ?
~
~
![]()
$this->getController()->setRenderMode(sfView::RENDER_NONE);
$this->setLayout(false);
if(/* Upload was successful */)
{
$this->logMessage("Upload was successful." ;);
return $this->renderText("1" ;);
}
else
{
$this->logMessage("Upload was not successful" ;);
return $this->renderText("0" ;);
}
dyke.ecl wrote: How can I check, what the problem realy is ?~
~
![]()
public function executeUpload(sfWebRequest $request)
{
$this->getController()->setRenderMode(sfView::RENDER_NONE);
$this->setLayout(false);
$fileName = $this->getRequest()->getFileName('Filedata');
$this->getRequest()->moveFile('Filedata', sfConfig::get('sf_upload_dir').'/'.$fileName);
return $this->renderText("1" ;);
}
brainwiz64 wrote: It looks like getFileName is not a valid method? I'm not sure... please let me know.
zooli wrote:hi!
thanks for the solution, file upload works, but some other things does not:
i'm using jquery ajax, to add links to a post. i'm storing them in the session object, and when the user saves the form, i'm also saving the links and files data to the database, move the files to their final destination, etc.
the point is, when i upload a file, my session object is gone, or at least i cannot access variables i set with getUser()->setAttribute()
i don't really understand why, i edited the mySessionHandler:
$options['session_id'] = $value;
but that did not solve my case.
any ideas? thanks!
apulmca2k4 wrote:Same issue as zooli.
Unable to set attributes using
$this->getUser()->setAttribute();
in the action for uploadify to upload files.
Files are uploading correctly but I am unable to add something in session..
Please suggest.
nfuids wrote:Hi!
I tried disturbed solution and I still have no luck.
I'm with sf 1.1..
In order to make sure everything was setup ok, I was using log and it appears that the session_name($sessionNamer4) and session_id($value) are in fact using the correct values.
So when someone uses uploadify to upload a file, the next time he reloads a page or navigate to another page, he's asked to login again.
Any idea?
Users browsing this forum: No registered users and 0 guests