表单不提交文件

时间:2012-04-06 05:46:48

标签: html forms file-upload

由于某种原因,下面的表单没有像它应该提交文件而且我不确定为什么,在服务器端如果我检查$ _FILES它总是空的但是如果我检查说$ _POST ['article']提交得很好,所以只有文件没有收到,那么有人看到这个有问题吗?

                <form action="newindex.php?do=submit" enctype="multipart/form-data" method="post">
                    Subject:<br>
                    <input type="text" id="subject" name="subject"><br>
                    <textarea id="article" id="article" name="article"></textarea><br>
                    <div class="sliderimage"><h2 class="blockhead">Slider Image:</h2>
                    <table><tr><td><b>Image:</b><br>Dimensions should be 640x360.</td><td>
                    <input type="file" id="image" name="image"></td></tr>
                    <tr><td><b>Transition:</b></td><td>
                    <select id="transition" name="transition">
                        <option value="">Random</option>
                        <option value="sliceDown">slideDown</option>
                        <option value="sliceDownLeft">sliceDownLeft</option>
                        <option value="sliceUp">sliceUp</option>
                        <option value="sliceUpLeft">sliceUpLeft</option>
                        <option value="fold">fold</option>
                        <option value="fade">fade</option>
                        <option value="slideInRight">slideInRight</option>
                        <option value="slideInLeft">slideInLeft</option>
                        <option value="boxRandom">boxRandom</option>
                        <option value="boxRain">boxRain</option>
                        <option value="boxRainReverse">boxRainReverse</option>
                        <option value="boxRainGrow">boxRainGrow</option>
                        <option value="boxRainGrowReverse">boxRainGrowReverse</option>
                    </select></td></tr>
                    <tr><td><b>Caption:</b></td><td>
                    <input type="text" id="caption" name="caption"></table><br></div>
                    <input type="hidden" name="securitytoken" value="<?php echo $vbulletin->userinfo['securitytoken'] ?>" />
                    <div class="center"><input type="button" value="Preview" class="preview"><input type="submit" name="submit"></div>
                </form>

2 个答案:

答案 0 :(得分:3)

您需要输入指定最大文件大小:

http://www.php.net/manual/en/features.file-upload.post-method.php

答案 1 :(得分:0)

将size属性放入,这将有效。

<input id="image" name="image" type="file" size = '50'"/>