0

I am using a html template.and i have a form with file upload option.there is a contact_process.php file where the collected data is sending as an email.The issue is i am not getting the file uploaded.only the name is getting in the mail. This is the html code of file upload.

<div  class="projectfileupload form-group">
    <input  id="inputfile" name="inputfile" type="file" class="form-control-file form-control text-danger font-weight-bold">
    <p  id="inputfiledetail" class="form-control text-left">Select or Drop your file here</p>
</div>

in contact_process.php

the file is reading as

$inputfile = $_FILES['inputfile'];

i am not getting anything.simply NULL.

as it is an html template the php.ini file is not theree.is that the issue. Any body pls help.

jaina
  • 11
  • 4
  • Does this answer your question? [Sending an uploaded file as attachment to email](https://stackoverflow.com/questions/12142461/sending-an-uploaded-file-as-attachment-to-email) – Unbranded Manchester Jun 11 '20 at 07:03
  • i am getting the value $_files['inputfile'] as null.i am using an html template.php.ini file is not there.is that the issue? – jaina Jun 12 '20 at 06:15
  • if anybody knows about it.pls help.it's urgent – jaina Jun 12 '20 at 06:16

1 Answers1

0

Use $_FILES.

What is $_FILES?

$_FILES is a two dimensional associative global array of items which are being uploaded by via HTTP POST method and holds the attributes of files. These attributes are as follows:

  • [name] - Name of file which is uploading
  • [size] - Size of the file
  • [type] - Type of the file
  • [tmp_name] - A temporary address where the file is located before processing the upload request
  • [error] - Types of error occurred when the file is uploading

Here is an e.g.:

<?php
    echo '<pre>';
    print_r($_FILES); 
    echo '</pre>';
?>

<form action="" method="post">
  <input type="file" name="inputfile">
  <input type="submit" value="Upload">
</form>
  • i want to know one thing.i am using an html tempate.there is no php.ini file.when uploading the file the name is showing.but when trying to print $_FILES('inputfile').it is showing null.i wnt to know what is the issue? if anybody knows a solution pls help. – jaina Jun 12 '20 at 06:14