Share » Forums » Setup & design » Redirect URL after upload

Redirect URL after upload

Redirect URL after upload

Monday 12 September 2005 1:16:15 am - 4 replies

Author Message

Kristof Coomans

Monday 12 September 2005 3:12:01 am

In which template do you want to specify the URI to redirect to?

I don't think content/upload supports this at the moment. But you can modify it to use some HTTP POST variables.

Replace this code:

$upload = new eZContentUpload( );

With the following lines:

$constructorParams = array( );

if ( $http->hasPostVariable( 'RedirectURIAfterResult' ) )
{
    $constructorParams['result_uri'] = $http->postVariable( 'RedirectURIAfterResult' );    
}

if ( $http->hasPostVariable( 'RedirectURIAfterCancel' ) )
{
    $constructorParams['cancel_uri'] = $http->postVariable( 'RedirectURIAfterCancel' );   
}

if ( count( $constructorParams ) > 0 )
{
    $upload = new eZContentUpload( $constructorParams );    
}
else
{
    $upload = new eZContentUpload( );
}

Now you can use the POST variables RedirectURIAfterResult and RedirectURIAfterCancel.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Felix Laate

Monday 12 September 2005 3:27:30 am

Hi Kristof!

Thank you for you swift answer. Really appreciate it. I'll give it a try!

Meanwhile I "solved" the problem by making an override for the folder in which the images are uploaded.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Kristof Coomans

Monday 12 September 2005 5:05:27 am

I forgot to set the needed session variable, so here's a correction of my code:

$constructorParams = array( );

if ( $http->hasPostVariable( 'RedirectURIAfterResult' ) )
{
    $constructorParams['result_uri'] = $http->postVariable( 'RedirectURIAfterResult' );    
}

if ( $http->hasPostVariable( 'RedirectURIAfterCancel' ) )
{
    $constructorParams['cancel_uri'] = $http->postVariable( 'RedirectURIAfterCancel' );   
}

if ( count( $constructorParams ) > 0 )
{
    $http->setSessionVariable( 'ContentUploadParameters', $constructorParams );
    $upload = new eZContentUpload( $constructorParams );
}
else
{
    $upload = new eZContentUpload( );
}

I've also found a bug in kernel/content/upload.php, which prevents my code snippet to work. See http://ez.no/bugs/view/7139.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Nabil Alimi

Tuesday 13 September 2005 3:56:12 am

Hi,

If you add an Redirect_URI in your form, cant it solve your problem ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu