本文整理汇总了PHP中FileUpload::upload_file方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::upload_file方法的具体用法?PHP FileUpload::upload_file怎么用?PHP FileUpload::upload_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUpload
的用法示例。
在下文中一共展示了FileUpload::upload_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$heading1 = $_POST['heading1'];
$link1 = $_POST['link1'];
$description1 = $_POST['description1'];
$heading2 = $_POST['heading2'];
$link2 = $_POST['link2'];
$description2 = $_POST['description2'];
$heading3 = $_POST['heading3'];
$link3 = $_POST['link3'];
$description3 = $_POST['description3'];
$photo1 = $_FILES['photo1']['name'];
$photo2 = $_FILES['photo2']['name'];
$photo3 = $_FILES['photo3']['name'];
}
if (!empty($photo1)) {
//1st other image upload
$result_upload_1st = $uploadFile->upload_file('slider_1st', 'photo1', '../../../img/');
//photo_name variable saves the image location
$photo_name1 = "img/" . $result_upload_1st;
} else {
$photo_name1 = "";
}
if (!empty($photo2)) {
//2nd other image upload
$result_upload_2nd = $uploadFile->upload_file('slider_2nd', 'photo2', '../../../img/');
//photo_name variable saves the image location
$photo_name2 = "img/" . $result_upload_2nd;
} else {
$photo_name2 = "";
}
if (!empty($photo3)) {
//3rd other image upload
示例2: substr
$c_id = $manageData->getLastValue("coupon_table", "coupon_id", "id");
if ($c_id[0]['coupon_id'] != "") {
//setting the new coupon id increamented by 1
$new_c_id = substr($c_id[0]['coupon_id'], 7) + 1;
//coupon id for new coupon
$coupon_id = "Coupon_" . $new_c_id;
} else {
$coupon_id = "Coupon_1001";
}
/* product id is set*/
//getting current date/time
$getdate = getdate();
$date = $getdate['year'] . "-" . $getdate['mon'] . "-" . $getdate['mday'];
if (!empty($photo)) {
//move the uploaded file to the UI Layer img folder of main image
$result_upload = $uploadFile->upload_file($coupon_id, 'photo', '../../../img/');
//photo_name variable saves the image location
$photo_name = "img/" . $result_upload;
} else {
$photo_name = "";
}
if (!empty($photo1)) {
//1st other image upload
$result_upload_1st = $uploadFile->upload_file($coupon_id . '_1st', 'photo1', '../../../img/');
//photo_name variable saves the image location
$photo_name1 = "img/" . $result_upload_1st;
} else {
$photo_name1 = "";
}
if (!empty($photo2)) {
//2nd other image upload
示例3: substr
}
/* creating product id for new product */
//getting last value of product id
$p_id = $manageData->getLastValue("membership_product", "product_id", "product_id");
if ($p_id[0]['product_id'] != "") {
//setting the new product id increamented by 1
$new_p_id = substr($p_id[0]['product_id'], 2) + 1;
//product id for new product
$product_id = "M_" . $new_p_id;
} else {
$product_id = "M_1001";
}
/* product id is set*/
if (!empty($photo)) {
//move the uploaded file to the UI Layer img folder
$result_upload = $uploadFile->upload_file($product_id, 'photo', '../../../img/');
//photo_name variable saves the image location.
$photo_name = "img/" . $result_upload;
} else {
$photo_name = "";
}
/*checking the number of product is more than '5' or not
* setting the database value for stock column
*/
if ($stock > 5) {
$status = 1;
} else {
$status = 0;
}
//discount is set or not
if (!empty($discount)) {