Hallo,
Ik heb een script waarmee ik fotos kan uploaden...
Maar als ik de foto wil uploaden krijg ik de volgende foutmelding:
Warning: move_uploaded_file(/usr/export/www/hosting/rateapicture/fotoalbum/photos/Cartoons/aapk.jpg): failed to open stream: No such file or directory in /usr/export/www/hosting/rateapicture/admin/fotoupload.php on line 22
Warning: move_uploaded_file(): Unable to move '/usr/export/tmp/phpWQiqdX' to '/usr/export/www/hosting/rateapicture/fotoalbum/photos/Cartoons/aapk.jpg' in /usr/export/www/hosting/rateapicture/admin/fotoupload.php on line 22
Dit is mijn code van fotoupload.php:
[syntax="php"]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Upload foto!</title></head>
<body bgcolor="#D5D5D5">
<?
include '../config.php';
$photo = $_GET['pic'];
$folder = $_GET['folder'];
if($_POST['submit']){
if (is_uploaded_file($_FILES['uploadfoto']['tmp_name'])){
$filename = $_FILES['uploadfoto']['name'];
$extensie = substr($filename, -3);
if (strtoupper($extensie) != "JPG" && strtoupper($extensie) != "GIF" && strtoupper($extensie) != "BMP" && strtoupper($extensie) != "ZIP") {
echo "<BR><font size='2' face='Verdana'>Je kan alleen gif, jpg, bmp en zip-bestanden uploaden!";
}
else {
$store_pad = $_SERVER['DOCUMENT_ROOT']."/fotoalbum/photos/".$_GET['folder'];
$file = $_FILES['uploadfoto']['name'];
move_uploaded_file($_FILES['uploadfoto']['tmp_name'], "$store_pad/$file") or die("fout");
if (strtoupper($extensie) == "ZIP"){
$path = $_SERVER['DOCUMENT_ROOT']."/fotoalbum/photos/".$_GET['folder']."/";
$filee = $store_pad."/".$file;
$zip = zip_open($filee);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_filesize($zip_entry) > 0) {
$complete_path = $path.dirname(zip_entry_name($zip_entry));
$complete_name = $path.str_replace("%20","_",zip_entry_name($zip_entry));
if (zip_entry_open($zip, $zip_entry, "r")) {
$fd = fopen($complete_name, 'w');
fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
fclose($fd);
zip_entry_close($zip_entry);
}
}
}
zip_close($zip);
}
}
unlink($filee);
echo "<BR><font size='2' face='Verdana'>Het bestand is geupload!</font><BR><BR><INPUT type=submit value='Sluit venster!' onClick=\"window.opener.location='$url/admin/index.php?folder=$folder&photo=$file'; window.close();\">";
}
}
}
else if($_GET['aktie'] == "delete"){
echo "<BR><font size='2' face='Verdana'>Weet je zeker dat je onderstaande foto wilt verwijderen?</font><BR><INPUT type=submit value='Ja' onClick=\"window.location='$url/admin/fotoupload.php?aktie=deletefinal&folder=$folder&pic=$photo';\"><INPUT type=submit value='Nee' onClick=\"window.opener.location='$url/index.php?folder=$folder&photo='; window.close();\">";
if ($folder != "") {
$photoo = "../photos/$folder/$photo";
}
else {
$photoo = "../photos/$photo";
}
$image_size = getimagesize($photoo);
$image_width = $image_size[0];
$image_height = $image_size[1];
if ($image_width > 350) {
$value = $image_width / 350;
$display_width = 350;
$display_height = round ($image_height / $value);
}
else {
$display_width = $image_width;
$display_height = $image_height;
}
echo "<BR><BR><center><img src='$photoo' width='$display_width' heigth='$display_height'></center>";
}
else if($_GET['aktie'] == "deletefinal"){
mysql_query("DELETE FROM foto_reacties WHERE picname = '$photo'");
mysql_query("DELETE FROM foto_info WHERE picname = '$photo'");
unlink("../photos/$folder/$photo");
echo "<BR><font size='2' face='Verdana'>De foto is verwijderd!</font><BR><BR><INPUT type=submit value='Sluit venster!' onClick=\"window.opener.location='$url/admin/index.php?folder=$folder&photo='; window.close();\">";
}
else {
?>
<form name='wijzig' method='post' action='fotoupload.php?folder=<? echo $folder; ?>' enctype='multipart/form-data'>
<input type='file' name='uploadfoto'>
<input type='submit' name='submit' value='submit'>
</form>
<?
}
?>
</body>
</html>[/syntax]