Forums / Setup & design / Redirect URL after upload

Redirect URL after upload

Author Message

Felix Laate

Monday 12 September 2005 1:16:15 am

Hi all!

I'm trying to figure out how to control the redirect_url variable of the content/upoload interface from a template.

Basically what I'm doing is letting user upload images. This works well. But I need to control where they come after uploading. As for now, the user gets to /media/images/whatever/upload_image..

Any ideas dear forum?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

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

eZ debug

Timing: Jan 19 2025 00:11:01
Script start
Timing: Jan 19 2025 00:11:01
Module start 'content'
Timing: Jan 19 2025 00:11:02
Module end 'content'
Timing: Jan 19 2025 00:11:02
Script end

Main resources:

Total runtime0.9274 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0090 587.7109180.8359
Module start 'content' 0.00900.7598 768.5469617.3672
Module end 'content' 0.76890.1584 1,385.9141341.3750
Script end 0.9273  1,727.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00470.5030210.0002
Check MTime0.00160.1750210.0001
Mysql Total
Database connection0.00110.122110.0011
Mysqli_queries0.835990.13962020.0041
Looping result0.00260.27702000.0000
Template Total0.887795.720.4439
Template load0.00180.195920.0009
Template processing0.885995.527520.4430
Template load and register function0.00010.013410.0001
states
state_id_array0.00190.204410.0019
state_identifier_array0.00190.200520.0009
Override
Cache load0.00160.1694330.0000
Sytem overhead
Fetch class attribute can translate value0.00140.146440.0003
Fetch class attribute name0.00130.144680.0002
XML
Image XML parsing0.00170.179440.0004
class_abstraction
Instantiating content class attribute0.00000.0025100.0000
General
dbfile0.00440.4789390.0001
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs