mardi 14 novembre 2017

Redirect based on file upload

Seems like a no brainer if statement right? But for some reason.... I cannot get a page to load based on if a file was uploaded properly or not.

This is not the complete page, but this is what I am using atm that somewhat works...

elseif ($pn == "umov") {
        ?>
        <div class="container" style="margin-top: 20px;">
            <h1>Movie Updated</h1></div>
        <?php

            $umovim = $_FILES["my_field"];
                if ($umovim > ''){
                    include 'eupload.php';    
                    } if ($umovim == $umovim) {
                    include 'update_movie.php';
                    }
            }
            elseif ($pn == "inmov") {
        ?>
        <div class="container" style="margin-top: 20px;">
            <h1>New Movie Added</h1></div>

Here is what happens...

If I do not upload a photo, the program will call update_movie.php. If I do upload a photo, I get both eupload.php and update_movie.php.

I tried using else and elseif instead of if and I get a blank page meaning that the script is not calling or loading the update_movie.php.

I am not sure what value is being passed by $umovim = $_FILES["my_field"];. When I echo the result to the page all it says is ARRAY.

Any suggestion would be appreciated. Thanks.

Aucun commentaire:

Enregistrer un commentaire