Re: upload issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Børge Holen wrote:
On Sunday 17 February 2008 19:22:03 nihilism machine wrote:
any idea why this fails?this is the error: "Sorry, there was a problem
uploading your file"

<?php

require_once("classes/db.class.php");

$target = "";
$fileName = basename( $_FILES['uploaded']['name']);
$extension = strtolower(strrchr($fileName,"."));
$DB = new DB();
$insertID = $DB->insert_sql("INSERT INTO CMS_Media (File_Name) VALUES
('')");
$target = "media/" . $insertID . $extension;
//echo $target;
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
	// Error
	echo "File was uploaded!";
} else {
	echo "Sorry, there was a problem uploading your file.";
}

chmod($target, 0755);

header("Location: crop.php?imageName=$newFileName");

?>


This looks weird. is this actually anything: $_FILES['uploaded']['tmp_name']. I always used $_FILES['tmp_name'], $_FILES['name'] and such

According to php docs it's always a multi-dimensional array:
http://www.php.net/manual/en/features.file-upload.php

The 'uploaded' is what you call the file input in your form.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux