Posted By

bradless on 03/23/10


Tagged

php file upload


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

novatvstdios


uploaded file handling with php


 / Published in: PHP
 

  1. // $_FILES array
  2. // $_FILES['field_name']['name'] = filename
  3. // $_FILES['field_name']['type'] = mime type, if provided by browser
  4. // $_FILES['field_name']['size'] = file size in bytes
  5. // $_FILES['field_name']['tmp_name'] = temp file name / location
  6. // $_FILES['field_name']['error'] = error code
  7.  
  8. if(is_uploaded_file($_FILES['field_name']['tmp_name'])) {
  9. $file = file_get_contents($_FILES['field_name']['tmp_name']);
  10. // do something with $file
  11. }

Report this snippet  

You need to login to post a comment.