dtp19819 2012-03-06 20:53
浏览 39

PHP文件上传数组为空

I am having trouble with an upload form Was previously working but not sure what happened to make it non-functional. When I upload a file with this form:

<form action="http://localhost/index.php/sales/quickadd/" method="post" accept-charset="utf-8" id="quickadd" class="inlineform" enctype="multipart/form-data">
        <div class="grid_12">
            <fieldset class="formfldset">
                <legend>Sales Sheet Quick Add</legend>
                <label for="sales_date" style="width: 15em; ">Sales Date</label><input type="text" name="sales_date" value="" id="sales_date" class="datepicker hasDatepicker"><br>
                <label style="width: 15em; ">Location</label>
                    <select id="locations_id" name="locations_id">
                <option value="23">Beer Tavern</option></select><br>
                <label for="import_file" style="width: 15em; ">Import File</label><input type="file" name="import_file" value="" id="import_file"> - <a href="#" id="guidelines">Import file guidelines</a><br>
                <label style="width: 15em; ">Show Import Warnings</label> <input type="checkbox" name="showimportwarnings" checked=""><span class="systemwarning">&nbsp; -- recommend leaving checked</span><br><br>
                <div class="systemwarning">Leaving the import file blank will create a Sales Sheet with all active sales items for the selected location.</div>
            </fieldset>
                <button name="submit" type="submit" id="submit" value="Add" formnovalidate="formnovalidate" class="" title="Add New Sales Sheet">Add New Sales Sheet</button><br>

        </div>
 </form>

After submitting the form, I do a var_dump($_FILES) and get an empty array. I am expecting to be able to detect the file and process it. This print statement never gets called.

if($_FILES['import_file']['tmp_name'] != '')
{
      echo 'print here';
}

The file is only 2.7kb and the max upload is set to 2MB. I don't get any errors printed out or in apache log files. I have E_ALL error reporting for php. I hope there is something simple that I just forgot. I'm using codeigniter.

TIA

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?