Use the full path when calling move_uploaded_file()

This commit is contained in:
Chris Morgan
2005-07-30 16:04:57 +00:00
committed by WineHQ
parent 5df2203821
commit f14d6a20ab

View File

@@ -79,18 +79,20 @@ class Screenshot {
if(query_appdb("INSERT INTO appData $sFields VALUES $sValues", "Error while creating a new screenshot."))
{
$this->iScreenshotId = mysql_insert_id();
if(!move_uploaded_file($hFile['tmp_name'], "data/screenshots/originals/".$this->iScreenshotId))
{
/* make sure we supply the full path to move_uploaded_file() */
$moveToPath = appdb_fullpath("data/screenshots/originals/").$this->iScreenshotId;
if(!move_uploaded_file($hFile['tmp_name'], $moveToPath))
{
// whoops, moving failed, do something
addmsg("Unable to move screenshot from ".$hFile['tmp_name']." to data/screenshots/originals/".$this->iScreenshotId, "red");
addmsg("Unable to move screenshot from '".$hFile['tmp_name']."' to '".$moveToPath."'", "red");
$sQuery = "DELETE
FROM appData
WHERE id = '".$this->iScreenshotId."'";
query_appdb($sQuery);
return false;
} else // we managed to copy the file, now we have to process the image
{
{
$this->sUrl = $this->iScreenshotId;
if($this->generate())
{