Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 883473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:35:42+00:00 2026-05-15T12:35:42+00:00

function new_photo() { if( !empty($this->data)) { $this->data[‘Photo’][‘showcase_id’] = $this->Session->read(‘CurrShowcase.id’); $this->data[‘Photo’][‘added’] = date(Y-m-d H:i:s); $this->Showcase->Photo->save($this->data);

  • 0
            function new_photo()
            {

                if( !empty($this->data))
                {
                        $this->data['Photo']['showcase_id'] = $this->Session->read('CurrShowcase.id');
                        $this->data['Photo']['added'] = date("Y-m-d H:i:s");
                        $this->Showcase->Photo->save($this->data);

                        $flasher = 'Photo uploaded successfully';
                        $flasher .= '<br/><img src="' . $this->data['Photo']['thumbnail_url'] . '"/>';
                        $this->Session->setFlash($flasher);
                        //$this->redirect(array('action'=>'sc',));
                }
            }   

I have a Showcase Controller in my CakePHP app, and a new photo form to submit new photos. Whenever I uncomment the last line that redirects after the data is saved, I get this error:

Warning (2): Cannot modify header information - headers already
sent by (output started at D:\.....

Even if I get this error, $this->data still gets saved properly in the database. However, if I comment the redirect line as shown above, everything works fine and error-free. I HAVE checked for blank spaces around the tags, so I’m pretty sure it’s not that.

Any ideas?

Edit:
commenting out the setFlash statement does not fix the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:35:42+00:00Added an answer on May 15, 2026 at 12:35 pm

    Change your debug mode to 0 to make sure it’s not a notice/warning being generated prior to the redirect. Also, you might want to tighten up your processing section to (be paranoid and) ensure that it’s not using invalid indexes, as well as anywhere else throughout the application flow for that action to make sure you’re not getting any ouput (if it works when you change debug to 0).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This link shows you that jQuery uses (new Function(return + data))(); for older browsers,
a = new function() { this.x=2; B=function() { this.y=super.x; } this.b=new B(); } alert(a.b.y);
I have a image from files = request.FILES['new_photo'].read() and i want to know it's
I am trying to create a photo upload function for a website, and there
This is the extend function from the book Pro JavaScript Design Patterns function extend(subClass,
I have this photo gallery http://lifelistchase.com/japan-photo-gallery Each image is uploaded and inserted as a
I have a function in which I'm trying to resize a photo twice from
I'm building an app that takes a photo and then e-mails it. For this
function StringStream() {} StringStream.prototype = new Array(); StringStream.prototype.toString = function(){ return this.join(''); }; Calling
Am trying to write a new record using the jquery function. $.post(insertuser.php,$(#rohanStart).serialize(),function(data){ alert(data); });

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.