-2

I'm trying to upload an image in a specific folder, but I'm getting nothing, not even an error message, when I click on upload button I get a blank page, and that's it, What am I missing?

 <?php if ((isset($_POST["enviado"])) && ($_POST["enviado"] == "form2")) {
    $nome_arquivo = $_FILES['userfile']['name']; 
    move_uploaded_file($_FILES['userfile']['tmp_name'],  "../legendofgames/documentos/games/".$nome_arquivo);
?>

    <script>
    opener.document.form2.strImage.value="<?php echo $nome_arquivo; ?>";
    self.close();
    </script>
    <?php
    }
    else
    {?>

.

<form  method="post" enctype="multipart/form-data" id="form2">

<p>
<input name="userfile" type="file" />
</p>
<p>
<input type="submit" name="button" id="button" value="Upload Image" />
</p>
<input type="hidden" name="enviado" value="form2" />
</form>
<?php }?>
4

1 回答 1

1

1.turn on error reporting in php.ini file or add this line at first:

<?php error_reporting(E_ALL); ?>

2.It seems that u have an syntax error on line 4: forget to close php code by ?>

<?php if ((isset($_POST["enviado"])) && ($_POST["enviado"] == "form2")) {
$nome_arquivo = $_FILES['userfile']['name']; 
move_uploaded_file($_FILES['userfile']['tmp_name'],  "../legendofgames/documentos/games/".$nome_arquivo);
?>


<script>
opener.document.form2.strImage.value="<?php echo $nome_arquivo; ?>";
self.close();
</script>
<?php
}
else
{?>
于 2013-05-06T01:33:48.307 回答