当我上传文件的文件名和文件大小时,我遇到了这个问题:http://imgur.com/KptVwiM现在显示在我的网页顶部:http://imgur.com/VkqRxPv。
我不知道这是怎么发生的,并没有发现任何与输入文件类型相关的CSS,所以我可以重新定位文本。我的css都没有重新定位文本放置的<lu>
或<li>
标记。
这里是我的表单中的代码 [编辑]我用文件的其余部分(仅限正文)更新了此代码:
<body onLoad="javascript:LoadPage();" onblur="SetCaching(2);" onfocus="SetCaching(3);">
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="container">
<table>
<tr>
<td>
<div id="chatcontent" style="background-image:url('assets/img/main.png'); height: 400px; width:550px;">
//filename and filesize get outputted here
</div>
</td>
<td>
<div id="chatlogo">
<img src="assets/img/reclame.png" alt="reclame" id="reclame"/>
</div>
</td>
</tr>
<tr>
<td>
<div id="messagearea">
<form role="form" id="fMain" name="fMain" onSubmit="SetCaching(3); return Submit();">
<div id="messageControls" >
<div style="width: 420px;float: left;">
<input class="form-control" type="text" id="textmessage" name="textmessage" autocomplete="off" placeholder="<?php echo $chat_textbox; ?>" onClick="if(this.value == 'Type hier...') this.value='';" onkeypress="javascript:SetCaching(1);" onblur="javascript:SetCaching(3)"/>
</div>
<div style="float: right;">
<input class="btn btn-warning" type="button" value="<?php echo $chat_chatsend; ?>" autocomplete="off" style="width:115px;" onClick="javascript:SendChat();"/>
</div>
<br/><br/>
<div>
<p style="font-size: 14px;" id="lblStatus" name="lblStatus">
</p>
</div>
</div>
<div class="fb-like" data-href="https://www.facebook.com/ivolnl" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
</form>
</div>
</td>
<td>
<div id="upload">
<form id="fupload" method="post" action="upload.php" enctype="multipart/form-data">
<input class="btn btn-warning" type="button" id="uplLink" value="Bestand uploaden" autocomplete="off" style="width:115px; min-width: 151px;" onclick="$('#upl').trigger('click');" />
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
<input type="file" name="upl" id="upl"/>
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
的CSS:
#uplLink{
margin-top: 10px;
}
#upl{
cursor:pointer;
display:inline-block;
margin-left:0px;
}
php file upload.php:
$allowed = array('png', 'jpg', 'gif', 'jpeg', 'psd', 'ai', 'pdf');
if($_FILES["upl"]["size"] < 10000000) {
if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
$cookie = $_COOKIE["ChatID"];
$path = "uploads/" . $cookie;
if(!in_array(strtolower($extension), $allowed)){
exit;
}
if (!file_exists($path)) {
mkdir($path, 0777, true);
}
$name = $_FILES['upl']['name'];
$actual_name = pathinfo($name,PATHINFO_FILENAME);
$original_name = $actual_name;
$name_extension = pathinfo($name, PATHINFO_EXTENSION);
$i = 1;
while(file_exists($path."/".$actual_name.".".$name_extension))
{
$actual_name = (string)$original_name."_".$i;
$name = $actual_name.".".$name_extension;
$i++;
}
if(move_uploaded_file($_FILES['upl']['tmp_name'], $path."/".$name)){
exit;
}
}
}
exit;
从我所看到的是,某种方式是随机放置在第一个<lu>
标签中。我正在localhost XAMPP服务器上进行此操作。
答案 0 :(得分:0)
Oke,所以我发现了问题,我在头部包含了一个脚本,它使用jquery.fileupload来上传文件。在那里它被指定输出数据是我不想要它,所以我改变了它。感谢所有评论,特别是@Deadooshka