Php image/file upload no errors - white page -


i attempting write upload script getting no errors error reporting on , blank screen, have checked script , cannot spot syntax errors far can see - know part causing error not sure why?

it first block because if remove form shows:

<?php # uploading files woooo   // check if form has been submitted: if (isset($_server['request_method'] == 'post') {      // check , uploaded file:     if (isset($_files['upload'])) {          // validate type. should jpeg or png.         $allowed = array ('image/pjpeg', 'image/jpeg', 'image/jpg', 'image/x_png', 'image/png', 'image/x-png');         if (in_array($_files['upload']['type'], $allowed)) {              // move files on             if (move_uploaded_file($_files['upload']['tmp_name'], "../uploads/{$_files['upload']['name']}")){                 echo '<p><em>the file has been uploaded</em></p>';             } // end of move.... if.          } else { // inavalid type.             echo '<p class="error">please upload jpeg or pn image.</p>';         }      } } 

the script continued seems ok...

// check error:      if ($_files['upload']['error'] > 0) {         echo '<p class="error">the file not uploaded because <strong>';              // print message based upon error              switch ($_files['upload']['error']) {                 case 1:                     print 'the file exceeds upload_max filesize setting in php.ini';                     break;                 case 2:                     print 'the file exceeds max_file_size setting in html form';                     break;                 case 3:                     print 'the file partially uploaded';                     break;                 case 4:                     print 'no file uploaded';                     break;                 case 6:                     print 'no temp folder available.';                     break;                 case 7:                     print 'unable write disk.';                     break;                 case 8:                     print 'file upload stopped.';                     break;                                       default:                     print 'a system error occured';                     break;              } // end of switch              print '</strong></p>';          } // enf of error if          // delete file if still exists          if (file_exists ($_files['upload']['tmp_name']) && is_file($_files['upload']['tmp_name'])) {             unlink ($_files['upload']['tmp_name']);          } // enf of submitted form      ?>    <form enctype="multipart/form-data" method="post" action="info.php">      <input type="hidden" name="max_file_size" value="524288">      <fieldset>         <legend>select jpeg or png image of 512kb or smaller uploaded</legend>         <p><b><input type="file" name="upload"></p>     </fieldset>      <div align="center"><input type="submit" name="submit" value="submit" /></div>   </form> 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -