ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Add a php line into other php code

September 18, 2012 9:47pm

Subscribe [1]
  • #1 / Sep 18, 2012 9:47pm

    Brian_az

    36 posts

    Hello,

    Can anyone help me with a php question?

    I have the code

    <?php echo stash::get('profilepic') ?>

    where

    echo stash::get('profilepic')

    calls a saved variable ie bob to make bob.jpg, but I cant figure out how to put php into other php.

    I want to add to the code below were it says HERE.

    <?php
    
    $filename = 'HERE.jpg';
    $result = file_put_contents('/var/www/virtual/mydomai.com/images/profile/'.$filename, file_get_contents('php://input') );
    if (!$result) {
        print "ERROR: Failed to write data to $filename, check permissions\n";
        exit();
    }
    
    $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $filename;
    print "$url\n";
    
    ?>

    Any ideas?

    Thanks!

  • #2 / Sep 20, 2012 3:09pm

    Kevin Smith

    4784 posts

    Hi Brian_az,

    While custom PHP work isn’t something we can help with here, I’d be happy to move this thread over to the Development and Programming forum if you like. That’s a spot where other programmers can toss in and help you work out a solution. Would you like me to do that?

  • #3 / Sep 21, 2012 6:58pm

    Brian_az

    36 posts

    Hi,

    Thanks for the follow up. I found a better way to do it.

    Thx!

  • #4 / Sep 24, 2012 4:15pm

    Dan Decker

    7338 posts

    Hey Brian,

    Excellent!

    Is your solution something you can go into? We’d love to see it.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases