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,11 +79,13 @@ class Screenshot {
if(query_appdb("INSERT INTO appData $sFields VALUES $sValues", "Error while creating a new screenshot.")) if(query_appdb("INSERT INTO appData $sFields VALUES $sValues", "Error while creating a new screenshot."))
{ {
$this->iScreenshotId = mysql_insert_id(); $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 // 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 $sQuery = "DELETE
FROM appData FROM appData
WHERE id = '".$this->iScreenshotId."'"; WHERE id = '".$this->iScreenshotId."'";