- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi,
i followed a tutorial on how to create a image gallery with a admin panel, and when i tried to upload a image, it gave me this error:
Warning: move_uploaded_file(C:/webroot/gallery/images/gallery/c1b55bfadb00c4304fb9f774eefafb93.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:xampplitehtdocsphpcmslibraryfunctions.php on line 21
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘C:xampplitetmpphp22F.tmp’ to ‘C:/webroot/gallery/images/gallery/c1b55bfadb00c4304fb9f774eefafb93.png’ in C:xampplitehtdocsphpcmslibraryfunctions.php on line 21
Error uploading file
line 21 on functions.php is part of a function to upload the images:
if (trim($image[‘tmp_name’]) != ”) {
$ext = substr(strrchr($image[‘name’], “.”), 1);
$imagePath = md5(rand() * time()) . “.$ext”;
$result = move_uploaded_file($image[‘tmp_name’], $uploadDir . $imagePath);
if ($result) {
$thumbnailPath = md5(rand() * time()) . “.$ext”;
$result = createThumbnail($uploadDir . $imagePath, $uploadDir . ‘thumbnail/’ . $thumbnailPath, THUMBNAIL_WIDTH);
if (!$result) {
unlink($uploadDir . $imagePath);
$imagePath = $thumbnailPath = ”;
} else {
$thumbnailPath = $result;
}
} else {
$imagePath = $thumbnailPath = ”;
}
}
Can someone please explain what is going on?
thanks,
James