Lid |
|
Hallo,
Ik gebruik onderstaand scriptje maar dit geeft een fout ivm de sql syntax op Line 4
<?php
if(isset($_POST['folder'])){
$file = $_FILES['file']['name'];
$size = $_FILES["file"]["size"];
if (($file !== ".") and ($file !== "..")) {
list($filename, $ext) = explode(".", $file);
list($main, $sub, $include) = explode("/", $PHP_SELF); }
mysql_query("INSERT INTO files (name,extension,size,map)
VALUES ('".$filename."',
'".$ext."',
'".$size."','".$_GET['id']."'") OR die (mysql_error());
copy($_FILES['file']['tmp_name'], "./uploads/" . $_FILES['file']['name']) or die("Er ging iets fout :-)");
?>
<div class="m_boxtop">Upload status</div>
<table style="border: 1px solid #CCCCCC;border-top:0px;margin-bottom: 10px;border-bottom: 0px;" width=100% cellpadding=4 cellspacing=0>
<tr>
<td width=5% style="border-bottom: 1px solid #CCCCCC;">
Uploading file (<?php echo $file ?>) succesfull!
</td>
</tr>
</table>
</div><?
}
else {
?>
<div class="m_boxtop">Upload bestand</div>
<table style="border: 1px solid #CCCCCC;border-top:0px;margin-bottom: 10px;border-bottom: 0px;" width=100% cellpadding=4 cellspacing=0>
<tr>
<td width=5% style="border-bottom: 1px solid #CCCCCC;">
<form action="index.php?mod=files&act=folder&id=<?=$_GET['id']; ?>" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" name="folder" value="upload">
</form>
</td>
</tr>
</table>
<? } ?>
<?php if(isset($_POST['folder'])){ $file = $_FILES['file']['name']; $size = $_FILES["file"]["size"]; if (($file !== ".") and ($file !== "..")) { list($main, $sub, $include) = explode("/", $PHP_SELF); } mysql_query("INSERT INTO files (name,extension,size,map) VALUES ('".$filename."', '".$ext."', copy($_FILES['file']['tmp_name'], "./uploads/" . $_FILES['file']['name']) or die("Er ging iets fout :-)"); ?> <div class="m_boxtop">Upload status</div> <table style="border: 1px solid #CCCCCC;border-top:0px;margin-bottom: 10px;border-bottom: 0px;" width=100% cellpadding=4 cellspacing=0> <tr> <td width=5% style="border-bottom: 1px solid #CCCCCC;"> Uploading file ( <?php echo $file ?>) succesfull! </td> </tr> </table> </div><? } else { ?> <div class="m_boxtop">Upload bestand</div> <table style="border: 1px solid #CCCCCC;border-top:0px;margin-bottom: 10px;border-bottom: 0px;" width=100% cellpadding=4 cellspacing=0> <tr> <td width=5% style="border-bottom: 1px solid #CCCCCC;"> <form action="index.php?mod=files&act=folder&id=<?=$_GET['id']; ?>" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" name="folder" value="upload"> </form> </td> </tr> </table> <? } ?>
De link is als volgt index.php?mod=files&act=folder&id=56
Hoe komt dit?
|