Prev | Current Page 441 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

'/product_images/' .
$_FILES['ImageUpload']['name']);
// Update the product's information in the database
Catalog::SetImage($this->_mProductId,
$_FILES['ImageUpload']['name']);
}
// If the error code is 0, the file was uploaded ok
if ($_FILES['Image2Upload']['error'] == 0)
{
/* Use the move_uploaded_file PHP function to move the file
from its temporary location to the product_images folder */
move_uploaded_file($_FILES['Image2Upload']['tmp_name'],
SITE_ROOT . '/product_images/' .
$_FILES['Image2Upload']['name']);
// Update the product's information in the database
Catalog::SetImage2($this->_mProductId,
$_FILES['Image2Upload']['name']);
}
// If the error code is 0, the file was uploaded ok
if ($_FILES['ThumbnailUpload']['error'] == 0)
{
// Move the uploaded file to the product_images folder
move_uploaded_file($_FILES['ThumbnailUpload']['tmp_name'],
SITE_ROOT . '/product_images/' .
$_FILES['ThumbnailUpload']['name']);
// Update the product's information in the database
Catalog::SetThumbnail($this->_mProductId,
$_FILES['ThumbnailUpload']['name']);
}
}
The $_FILES superglobal variable is a two-dimensional array that stores information about your uploaded file (or
files). If the $_FILES['ImageUpload']['error'] variable is set to 0, the main image of the product has
uploaded successfully and must be handled. The $_FILES['ImageUpload']['tmp_name'] variable stores the
temporary file name of the uploaded file on the server, and the $_FILES['ImageUpload']['name'] variable
stores the name of the file as specified when uploaded to the server.


Pages:
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453