uploaded file handling with php


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.