Nieuw lid |
|
Ik heb verhuisd van server voor mijn website en nu werkt het uploaden van bestanden plots niet meer.
<?
include("database.php");
include("variabelen.php");
if (!$submit) {
?>
<b>.:: Image Uploader</b>
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td width="50">ID</td>
<td>Bestand:</td>
</tr>
<?
$query = "SELECT * FROM downs ORDER BY `id` ASC";
$result = mysql_query($query);
?>
<?
while ($row = mysql_fetch_array($result)) {
?>
<tr>
<td width="50"><a href="index.php?module=imagedelete<?print("&id=$row[id]")?>" target="_parent"><?print("$row[id]")?></a></td>
<td><?print("$row[file]")?></td>
</tr>
<tr>
<td width="50"> </td>
<td><a href="<? echo "$download_url" ?><?print("$row[file]")?>" target="_blank"><? echo "$download_url" ?><?print("$row[file]")?></a></td>
</tr>
<?
}
?>
</table>
<br />
Klik op het bestands ID om het bestand te verwijderen.
<br /><br />
<FORM ENCTYPE="multipart/form-data" ACTION="index.php?module=imageupload" METHOD="POST">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="427" nowrap><b>.:: Bestand Uploaden</b></td>
</tr>
<tr>
<td width="427" nowrap valign="top" height="23"><div align="left">De bestanden komen in volgende map:<br>
<b><? echo "$download_url" ?></b><br>
<br>
<?print("<b><font color=\"FF0000\">$err_upload</font></b>")?> <br>
<input type="hidden" name="MAX_FILE_SIZE" value="2000000000000" class="form">
<input type="hidden" name="id" value="<?print("$id")?>" class="form">
<input name="userfile" type="file" class="form" size="35">
<br>
<input type="submit" value="Verzenden" name="submit" class="form">
</div></td>
</tr>
</table>
</FORM>
<?
} else {
if ($userfile_size > 2000000 || $userfile == "none") {
$err = "$userfile_type is te groot, upload een bestand kleiner dan 2Mb.";
header ("Location: index.php?module=imageupload&err_upload=" .$err."&tempid=".$tempid."&hash=".$hash);
exit;
}
$query = "SELECT file FROM downs WHERE id = '$id'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$pic = $row[file];
$path = "$upload_path/$pic";
$query = "SELECT file FROM downs WHERE file = '$pic'";
$result = mysql_query($query);
$cnt = 0;
while ($row = mysql_fetch_array($result)) {
$cnt = $cnt + 1;
}
if ($cnt == 1 && $pic) {
unlink($path);
}
$filename = $HTTP_POST_FILES['userfile']['name'];
$path = "$upload_path";
if (!move_uploaded_file($userfile, $path . $filename)) {
$err = "Er was een fout tijdens het uploaden van $userfile_type.";
echo "<p><b>.:: Image Uploader</b></p><p>Upload was <b>niet</b> succesvol. <a href=\"index.php?module=imageupload\">Klik hier om verder te gaan....</a>";
exit;
}
$query = "INSERT INTO downs (id, file) VALUES ('NULL', '$filename')";
$result = mysql_query($query) or die ("Kan niet invoegen in database...");
echo "<p><b>.:: Image Uploader</b></p><p>Upload succesvol. <a href=\"index.php?module=imageupload\">Klik hier om verder te gaan....</a>";
}
?>
<? include("database.php"); include("variabelen.php"); if (!$submit) { ?> <b>.:: Image Uploader</b> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tr> <td width="50">ID</td> <td>Bestand:</td> </tr> <? $query = "SELECT * FROM downs ORDER BY `id` ASC"; ?> <? ?> <tr> <td width="50"><a href="index.php?module=imagedelete <? print("&id=$row[id]")?>" target="_parent"> <? print("$row[id]")?></a></td> <td> <? print("$row[file]")?></td> </tr> <tr> <td width="50"> </td> <td><a href=" <? echo "$download_url" ?><? print("$row[file]")?>" target="_blank"> <? echo "$download_url" ?><? print("$row[file]")?></a></td> </tr> <? } ?> </table> <br /> Klik op het bestands ID om het bestand te verwijderen. <br /><br /> <FORM ENCTYPE="multipart/form-data" ACTION="index.php?module=imageupload" METHOD="POST"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="427" nowrap><b>.:: Bestand Uploaden</b></td> </tr> <tr> <td width="427" nowrap valign="top" height="23"><div align="left">De bestanden komen in volgende map:<br> <b> <? echo "$download_url" ?></b><br> <br> <? print("<b><font color=\"FF0000\">$err_upload</font></b>")?> <br> <input type="hidden" name="MAX_FILE_SIZE" value="2000000000000" class="form"> <input type="hidden" name="id" value=" <? print("$id")?>" class="form"> <input name="userfile" type="file" class="form" size="35"> <br> <input type="submit" value="Verzenden" name="submit" class="form"> </div></td> </tr> </table> </FORM> <? } else { if ($userfile_size > 2000000 || $userfile == "none") { $err = "$userfile_type is te groot, upload een bestand kleiner dan 2Mb."; header ("Location: index.php?module=imageupload&err_upload=" .$err."&tempid=".$tempid."&hash=".$hash); } $query = "SELECT file FROM downs WHERE id = '$id'"; $path = "$upload_path/$pic"; $query = "SELECT file FROM downs WHERE file = '$pic'"; $cnt = 0; $cnt = $cnt + 1; } if ($cnt == 1 && $pic) { } $filename = $HTTP_POST_FILES['userfile']['name']; $path = "$upload_path"; $err = "Er was een fout tijdens het uploaden van $userfile_type."; echo "<p><b>.:: Image Uploader</b></p><p>Upload was <b>niet</b> succesvol. <a href=\"index.php?module=imageupload\">Klik hier om verder te gaan....</a>"; } $query = "INSERT INTO downs (id, file) VALUES ('NULL', '$filename')"; $result = mysql_query($query) or die ("Kan niet invoegen in database..."); echo "<p><b>.:: Image Uploader</b></p><p>Upload succesvol. <a href=\"index.php?module=imageupload\">Klik hier om verder te gaan....</a>"; } ?>
In database.php staat connectie met database, in variabelen.php staat het upload path. Dit is al aangepast naar nieuwe server.
Er komt geen foutmelding op scherm, maar er wordt niks weggeschreven in de database en geupload naar de server
|