php - Undefined index when uploading image -


i trying create form user upload image using php.

here input file:

<form action="" method="post" enctype="multipart/form-data"> <input type="file" name="imagetoupload" id="imagetoupload">  </form> 

here php code:

<?php     $file_up_size = $_files["imagetoupload"]["size"]; ?> 

error -> notice: undefined index: imagetoupload ...

check if form sent, work variable.

if (isset($_files["imagetoupload"])) {     $file_up_size = $_files["imagetoupload"]["size"]; } 

Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -