How to use isset to show new data after submit and POST page refresh?












2














I use the following to POST a new file and works fine:



HTML



<div class="row">
<div class="col-xs-12">
<form method="POST" action="" enctype="multipart/form-data">
<div class="form-group">
<input type="file" name="postImage" multiple="multiple" class="form-control">
</div>
<input id="uploadImg" name="uploadImgCustom" type="submit" value="AGGIORNA ALLEGATO" class="btn secondary-btn primary-bg">
</form>
</div>
</div>


UPLOAD LOGIC



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}
$attachments = get_posts(array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' =>'any',
'post_parent' => $id
));

if ($attachments) {
foreach ( $attachments as $attachment ) {
$myNewImg = wp_get_attachment_url( $attachment->ID );
update_post_meta( $id, 'usp-file-single', $myNewImg);
}
$pathtofile = $myNewImg;
$info = pathinfo($pathtofile);
if ( ($info["extension"] == "jpg") || ($info["extension"] == "png") ) { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo $myNewImg; ?>" class="bnr_img img-responsive center-block" alt="">
</a>
<?php } else {
// Get the Video Fields
$video_mp4 = get_post_meta($id, 'usp-file-single', TRUE);
// Build the Shortcode
$attr = array(
'mp4' => $video_mp4,
'webm' => $video_webm,
'flv' => $video_flv,
'poster' => $video_poster,
'preload' => 'auto',
'autoplay' => "off"
);
// Display the Shortcode
echo wp_video_shortcode( $attr );
}
}


POST CHECK



if($_SERVER['REQUEST_METHOD']=="POST") {
if ('AGGIORNA ALLEGATO' === ($_POST['uploadImgCustom'])) {
if ($_FILES['postImage']) {
$attachments = get_attached_media( '', $id );
foreach ($attachments as $attachment) {
wp_delete_attachment( $attachment->ID, 'true' );
}
foreach ($_FILES as $file => $array) {
if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {
//Add your error action
} else {
$attach_id = media_handle_upload( $file, $id );
$myNewImg = get_post_meta($id, 'usp-file-single', true);
}
}
}
}
}


I tried to place the following before the html form



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}


However the page refreshes after the POST but I see the old value, if I manually refresh after the post refresh, I can see the new value tho. Am I using wrongly if isset?










share|improve this question
























  • you mean you want to retain the last uploaded file after submission in the input file? isn't that a security issue if its possible
    – Ghost
    Nov 23 '18 at 6:35










  • @Ghost nope, I am sending a file to DB, this changes what's in the db, it basically replaces it and works fine. however I am displaying this file on the page, but when I submit, the page shows the old one, yet the new file is in the db and I need to manually refresh the page again. It looks like cache of the page or something
    – rob.m
    Nov 23 '18 at 6:36










  • i don't know how the markup and the code are constructed in succession, but you could just follow the post redirect get pattern so that you get the new one
    – Ghost
    Nov 23 '18 at 7:15










  • the html mark up is what you see in there @Ghost you mean use GET instead of POST right? What about security?
    – rob.m
    Nov 23 '18 at 7:15








  • 1




    no need to, self answer will suffice. just provide the answer on how you solved it
    – Ghost
    Nov 23 '18 at 7:43
















2














I use the following to POST a new file and works fine:



HTML



<div class="row">
<div class="col-xs-12">
<form method="POST" action="" enctype="multipart/form-data">
<div class="form-group">
<input type="file" name="postImage" multiple="multiple" class="form-control">
</div>
<input id="uploadImg" name="uploadImgCustom" type="submit" value="AGGIORNA ALLEGATO" class="btn secondary-btn primary-bg">
</form>
</div>
</div>


UPLOAD LOGIC



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}
$attachments = get_posts(array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' =>'any',
'post_parent' => $id
));

if ($attachments) {
foreach ( $attachments as $attachment ) {
$myNewImg = wp_get_attachment_url( $attachment->ID );
update_post_meta( $id, 'usp-file-single', $myNewImg);
}
$pathtofile = $myNewImg;
$info = pathinfo($pathtofile);
if ( ($info["extension"] == "jpg") || ($info["extension"] == "png") ) { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo $myNewImg; ?>" class="bnr_img img-responsive center-block" alt="">
</a>
<?php } else {
// Get the Video Fields
$video_mp4 = get_post_meta($id, 'usp-file-single', TRUE);
// Build the Shortcode
$attr = array(
'mp4' => $video_mp4,
'webm' => $video_webm,
'flv' => $video_flv,
'poster' => $video_poster,
'preload' => 'auto',
'autoplay' => "off"
);
// Display the Shortcode
echo wp_video_shortcode( $attr );
}
}


POST CHECK



if($_SERVER['REQUEST_METHOD']=="POST") {
if ('AGGIORNA ALLEGATO' === ($_POST['uploadImgCustom'])) {
if ($_FILES['postImage']) {
$attachments = get_attached_media( '', $id );
foreach ($attachments as $attachment) {
wp_delete_attachment( $attachment->ID, 'true' );
}
foreach ($_FILES as $file => $array) {
if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {
//Add your error action
} else {
$attach_id = media_handle_upload( $file, $id );
$myNewImg = get_post_meta($id, 'usp-file-single', true);
}
}
}
}
}


I tried to place the following before the html form



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}


However the page refreshes after the POST but I see the old value, if I manually refresh after the post refresh, I can see the new value tho. Am I using wrongly if isset?










share|improve this question
























  • you mean you want to retain the last uploaded file after submission in the input file? isn't that a security issue if its possible
    – Ghost
    Nov 23 '18 at 6:35










  • @Ghost nope, I am sending a file to DB, this changes what's in the db, it basically replaces it and works fine. however I am displaying this file on the page, but when I submit, the page shows the old one, yet the new file is in the db and I need to manually refresh the page again. It looks like cache of the page or something
    – rob.m
    Nov 23 '18 at 6:36










  • i don't know how the markup and the code are constructed in succession, but you could just follow the post redirect get pattern so that you get the new one
    – Ghost
    Nov 23 '18 at 7:15










  • the html mark up is what you see in there @Ghost you mean use GET instead of POST right? What about security?
    – rob.m
    Nov 23 '18 at 7:15








  • 1




    no need to, self answer will suffice. just provide the answer on how you solved it
    – Ghost
    Nov 23 '18 at 7:43














2












2








2







I use the following to POST a new file and works fine:



HTML



<div class="row">
<div class="col-xs-12">
<form method="POST" action="" enctype="multipart/form-data">
<div class="form-group">
<input type="file" name="postImage" multiple="multiple" class="form-control">
</div>
<input id="uploadImg" name="uploadImgCustom" type="submit" value="AGGIORNA ALLEGATO" class="btn secondary-btn primary-bg">
</form>
</div>
</div>


UPLOAD LOGIC



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}
$attachments = get_posts(array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' =>'any',
'post_parent' => $id
));

if ($attachments) {
foreach ( $attachments as $attachment ) {
$myNewImg = wp_get_attachment_url( $attachment->ID );
update_post_meta( $id, 'usp-file-single', $myNewImg);
}
$pathtofile = $myNewImg;
$info = pathinfo($pathtofile);
if ( ($info["extension"] == "jpg") || ($info["extension"] == "png") ) { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo $myNewImg; ?>" class="bnr_img img-responsive center-block" alt="">
</a>
<?php } else {
// Get the Video Fields
$video_mp4 = get_post_meta($id, 'usp-file-single', TRUE);
// Build the Shortcode
$attr = array(
'mp4' => $video_mp4,
'webm' => $video_webm,
'flv' => $video_flv,
'poster' => $video_poster,
'preload' => 'auto',
'autoplay' => "off"
);
// Display the Shortcode
echo wp_video_shortcode( $attr );
}
}


POST CHECK



if($_SERVER['REQUEST_METHOD']=="POST") {
if ('AGGIORNA ALLEGATO' === ($_POST['uploadImgCustom'])) {
if ($_FILES['postImage']) {
$attachments = get_attached_media( '', $id );
foreach ($attachments as $attachment) {
wp_delete_attachment( $attachment->ID, 'true' );
}
foreach ($_FILES as $file => $array) {
if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {
//Add your error action
} else {
$attach_id = media_handle_upload( $file, $id );
$myNewImg = get_post_meta($id, 'usp-file-single', true);
}
}
}
}
}


I tried to place the following before the html form



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}


However the page refreshes after the POST but I see the old value, if I manually refresh after the post refresh, I can see the new value tho. Am I using wrongly if isset?










share|improve this question















I use the following to POST a new file and works fine:



HTML



<div class="row">
<div class="col-xs-12">
<form method="POST" action="" enctype="multipart/form-data">
<div class="form-group">
<input type="file" name="postImage" multiple="multiple" class="form-control">
</div>
<input id="uploadImg" name="uploadImgCustom" type="submit" value="AGGIORNA ALLEGATO" class="btn secondary-btn primary-bg">
</form>
</div>
</div>


UPLOAD LOGIC



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}
$attachments = get_posts(array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' =>'any',
'post_parent' => $id
));

if ($attachments) {
foreach ( $attachments as $attachment ) {
$myNewImg = wp_get_attachment_url( $attachment->ID );
update_post_meta( $id, 'usp-file-single', $myNewImg);
}
$pathtofile = $myNewImg;
$info = pathinfo($pathtofile);
if ( ($info["extension"] == "jpg") || ($info["extension"] == "png") ) { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo $myNewImg; ?>" class="bnr_img img-responsive center-block" alt="">
</a>
<?php } else {
// Get the Video Fields
$video_mp4 = get_post_meta($id, 'usp-file-single', TRUE);
// Build the Shortcode
$attr = array(
'mp4' => $video_mp4,
'webm' => $video_webm,
'flv' => $video_flv,
'poster' => $video_poster,
'preload' => 'auto',
'autoplay' => "off"
);
// Display the Shortcode
echo wp_video_shortcode( $attr );
}
}


POST CHECK



if($_SERVER['REQUEST_METHOD']=="POST") {
if ('AGGIORNA ALLEGATO' === ($_POST['uploadImgCustom'])) {
if ($_FILES['postImage']) {
$attachments = get_attached_media( '', $id );
foreach ($attachments as $attachment) {
wp_delete_attachment( $attachment->ID, 'true' );
}
foreach ($_FILES as $file => $array) {
if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {
//Add your error action
} else {
$attach_id = media_handle_upload( $file, $id );
$myNewImg = get_post_meta($id, 'usp-file-single', true);
}
}
}
}
}


I tried to place the following before the html form



$myNewImg = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['uploadImgCustom'];
}


However the page refreshes after the POST but I see the old value, if I manually refresh after the post refresh, I can see the new value tho. Am I using wrongly if isset?







php






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 7:48

























asked Nov 23 '18 at 6:23









rob.m

3,674103882




3,674103882












  • you mean you want to retain the last uploaded file after submission in the input file? isn't that a security issue if its possible
    – Ghost
    Nov 23 '18 at 6:35










  • @Ghost nope, I am sending a file to DB, this changes what's in the db, it basically replaces it and works fine. however I am displaying this file on the page, but when I submit, the page shows the old one, yet the new file is in the db and I need to manually refresh the page again. It looks like cache of the page or something
    – rob.m
    Nov 23 '18 at 6:36










  • i don't know how the markup and the code are constructed in succession, but you could just follow the post redirect get pattern so that you get the new one
    – Ghost
    Nov 23 '18 at 7:15










  • the html mark up is what you see in there @Ghost you mean use GET instead of POST right? What about security?
    – rob.m
    Nov 23 '18 at 7:15








  • 1




    no need to, self answer will suffice. just provide the answer on how you solved it
    – Ghost
    Nov 23 '18 at 7:43


















  • you mean you want to retain the last uploaded file after submission in the input file? isn't that a security issue if its possible
    – Ghost
    Nov 23 '18 at 6:35










  • @Ghost nope, I am sending a file to DB, this changes what's in the db, it basically replaces it and works fine. however I am displaying this file on the page, but when I submit, the page shows the old one, yet the new file is in the db and I need to manually refresh the page again. It looks like cache of the page or something
    – rob.m
    Nov 23 '18 at 6:36










  • i don't know how the markup and the code are constructed in succession, but you could just follow the post redirect get pattern so that you get the new one
    – Ghost
    Nov 23 '18 at 7:15










  • the html mark up is what you see in there @Ghost you mean use GET instead of POST right? What about security?
    – rob.m
    Nov 23 '18 at 7:15








  • 1




    no need to, self answer will suffice. just provide the answer on how you solved it
    – Ghost
    Nov 23 '18 at 7:43
















you mean you want to retain the last uploaded file after submission in the input file? isn't that a security issue if its possible
– Ghost
Nov 23 '18 at 6:35




you mean you want to retain the last uploaded file after submission in the input file? isn't that a security issue if its possible
– Ghost
Nov 23 '18 at 6:35












@Ghost nope, I am sending a file to DB, this changes what's in the db, it basically replaces it and works fine. however I am displaying this file on the page, but when I submit, the page shows the old one, yet the new file is in the db and I need to manually refresh the page again. It looks like cache of the page or something
– rob.m
Nov 23 '18 at 6:36




@Ghost nope, I am sending a file to DB, this changes what's in the db, it basically replaces it and works fine. however I am displaying this file on the page, but when I submit, the page shows the old one, yet the new file is in the db and I need to manually refresh the page again. It looks like cache of the page or something
– rob.m
Nov 23 '18 at 6:36












i don't know how the markup and the code are constructed in succession, but you could just follow the post redirect get pattern so that you get the new one
– Ghost
Nov 23 '18 at 7:15




i don't know how the markup and the code are constructed in succession, but you could just follow the post redirect get pattern so that you get the new one
– Ghost
Nov 23 '18 at 7:15












the html mark up is what you see in there @Ghost you mean use GET instead of POST right? What about security?
– rob.m
Nov 23 '18 at 7:15






the html mark up is what you see in there @Ghost you mean use GET instead of POST right? What about security?
– rob.m
Nov 23 '18 at 7:15






1




1




no need to, self answer will suffice. just provide the answer on how you solved it
– Ghost
Nov 23 '18 at 7:43




no need to, self answer will suffice. just provide the answer on how you solved it
– Ghost
Nov 23 '18 at 7:43












2 Answers
2






active

oldest

votes


















1














Thanks to a suggestion in comment, I eventually created a page refresh like this:



<?php
$myNewUploaded = get_post_meta($id, 'usp-file-single', true);
if (isset($_POST['uploadImgCustom'])) {
$myNewImg = $_POST['postImage'];
ob_start(); //this should be first line of your page
$myurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
header('Location: '.$myurl);
ob_end_flush(); //this should be last line of your page
}
?>
<form method="POST" action="" enctype="multipart/form-data">.....





share|improve this answer





























    0














    Try using this



       $myNewImg = get_post_meta($id, 'usp-file-single', true);
    if (!isset($_POST['uploadImgCustom'])) {
    $myNewImg = $_POST['uploadImgCustom'];
    }





    share|improve this answer





















    • nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
      – rob.m
      Nov 23 '18 at 6:45










    • have you used this !isset() and try to place before the submission ?
      – Akhtar Munir
      Nov 23 '18 at 6:50










    • yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
      – rob.m
      Nov 23 '18 at 6:50










    • so what you basically want to do with the file please clear us your question
      – Akhtar Munir
      Nov 23 '18 at 6:54










    • I want to show on the page the new uploaded file
      – rob.m
      Nov 23 '18 at 6:55













    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441535%2fhow-to-use-isset-to-show-new-data-after-submit-and-post-page-refresh%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Thanks to a suggestion in comment, I eventually created a page refresh like this:



    <?php
    $myNewUploaded = get_post_meta($id, 'usp-file-single', true);
    if (isset($_POST['uploadImgCustom'])) {
    $myNewImg = $_POST['postImage'];
    ob_start(); //this should be first line of your page
    $myurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    header('Location: '.$myurl);
    ob_end_flush(); //this should be last line of your page
    }
    ?>
    <form method="POST" action="" enctype="multipart/form-data">.....





    share|improve this answer


























      1














      Thanks to a suggestion in comment, I eventually created a page refresh like this:



      <?php
      $myNewUploaded = get_post_meta($id, 'usp-file-single', true);
      if (isset($_POST['uploadImgCustom'])) {
      $myNewImg = $_POST['postImage'];
      ob_start(); //this should be first line of your page
      $myurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
      header('Location: '.$myurl);
      ob_end_flush(); //this should be last line of your page
      }
      ?>
      <form method="POST" action="" enctype="multipart/form-data">.....





      share|improve this answer
























        1












        1








        1






        Thanks to a suggestion in comment, I eventually created a page refresh like this:



        <?php
        $myNewUploaded = get_post_meta($id, 'usp-file-single', true);
        if (isset($_POST['uploadImgCustom'])) {
        $myNewImg = $_POST['postImage'];
        ob_start(); //this should be first line of your page
        $myurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
        header('Location: '.$myurl);
        ob_end_flush(); //this should be last line of your page
        }
        ?>
        <form method="POST" action="" enctype="multipart/form-data">.....





        share|improve this answer












        Thanks to a suggestion in comment, I eventually created a page refresh like this:



        <?php
        $myNewUploaded = get_post_meta($id, 'usp-file-single', true);
        if (isset($_POST['uploadImgCustom'])) {
        $myNewImg = $_POST['postImage'];
        ob_start(); //this should be first line of your page
        $myurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
        header('Location: '.$myurl);
        ob_end_flush(); //this should be last line of your page
        }
        ?>
        <form method="POST" action="" enctype="multipart/form-data">.....






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 7:38









        rob.m

        3,674103882




        3,674103882

























            0














            Try using this



               $myNewImg = get_post_meta($id, 'usp-file-single', true);
            if (!isset($_POST['uploadImgCustom'])) {
            $myNewImg = $_POST['uploadImgCustom'];
            }





            share|improve this answer





















            • nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
              – rob.m
              Nov 23 '18 at 6:45










            • have you used this !isset() and try to place before the submission ?
              – Akhtar Munir
              Nov 23 '18 at 6:50










            • yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
              – rob.m
              Nov 23 '18 at 6:50










            • so what you basically want to do with the file please clear us your question
              – Akhtar Munir
              Nov 23 '18 at 6:54










            • I want to show on the page the new uploaded file
              – rob.m
              Nov 23 '18 at 6:55


















            0














            Try using this



               $myNewImg = get_post_meta($id, 'usp-file-single', true);
            if (!isset($_POST['uploadImgCustom'])) {
            $myNewImg = $_POST['uploadImgCustom'];
            }





            share|improve this answer





















            • nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
              – rob.m
              Nov 23 '18 at 6:45










            • have you used this !isset() and try to place before the submission ?
              – Akhtar Munir
              Nov 23 '18 at 6:50










            • yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
              – rob.m
              Nov 23 '18 at 6:50










            • so what you basically want to do with the file please clear us your question
              – Akhtar Munir
              Nov 23 '18 at 6:54










            • I want to show on the page the new uploaded file
              – rob.m
              Nov 23 '18 at 6:55
















            0












            0








            0






            Try using this



               $myNewImg = get_post_meta($id, 'usp-file-single', true);
            if (!isset($_POST['uploadImgCustom'])) {
            $myNewImg = $_POST['uploadImgCustom'];
            }





            share|improve this answer












            Try using this



               $myNewImg = get_post_meta($id, 'usp-file-single', true);
            if (!isset($_POST['uploadImgCustom'])) {
            $myNewImg = $_POST['uploadImgCustom'];
            }






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 23 '18 at 6:41









            Akhtar Munir

            6811




            6811












            • nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
              – rob.m
              Nov 23 '18 at 6:45










            • have you used this !isset() and try to place before the submission ?
              – Akhtar Munir
              Nov 23 '18 at 6:50










            • yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
              – rob.m
              Nov 23 '18 at 6:50










            • so what you basically want to do with the file please clear us your question
              – Akhtar Munir
              Nov 23 '18 at 6:54










            • I want to show on the page the new uploaded file
              – rob.m
              Nov 23 '18 at 6:55




















            • nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
              – rob.m
              Nov 23 '18 at 6:45










            • have you used this !isset() and try to place before the submission ?
              – Akhtar Munir
              Nov 23 '18 at 6:50










            • yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
              – rob.m
              Nov 23 '18 at 6:50










            • so what you basically want to do with the file please clear us your question
              – Akhtar Munir
              Nov 23 '18 at 6:54










            • I want to show on the page the new uploaded file
              – rob.m
              Nov 23 '18 at 6:55


















            nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
            – rob.m
            Nov 23 '18 at 6:45




            nope, I tried putting before the form and after the form, still see either the old file or an empty place right after submission, yet the file is uploaded and if I refresh i see it
            – rob.m
            Nov 23 '18 at 6:45












            have you used this !isset() and try to place before the submission ?
            – Akhtar Munir
            Nov 23 '18 at 6:50




            have you used this !isset() and try to place before the submission ?
            – Akhtar Munir
            Nov 23 '18 at 6:50












            yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
            – rob.m
            Nov 23 '18 at 6:50




            yes I have copied your code and if I place ti before the html form, the file is submitted and saved but once the page refreshes I don't see it. if I then manually refresh again then I can see the new file
            – rob.m
            Nov 23 '18 at 6:50












            so what you basically want to do with the file please clear us your question
            – Akhtar Munir
            Nov 23 '18 at 6:54




            so what you basically want to do with the file please clear us your question
            – Akhtar Munir
            Nov 23 '18 at 6:54












            I want to show on the page the new uploaded file
            – rob.m
            Nov 23 '18 at 6:55






            I want to show on the page the new uploaded file
            – rob.m
            Nov 23 '18 at 6:55




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441535%2fhow-to-use-isset-to-show-new-data-after-submit-and-post-page-refresh%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What visual should I use to simply compare current year value vs last year in Power BI desktop

            How to ignore python UserWarning in pytest?

            Alexandru Averescu