php 上传图片

// 获取图片
if (array_key_exists(‘image_file’, $_FILES) && is_uploaded_file($_FILES['image_file']['tmp_name'])) {
$image = $_FILES['image_file'];
}

$rand =rand(0,1000);
$child_dir = sprintf(“%03d”, intval($rand % 1000));
$path = $_SERVER['BEAUBEAU_STATIC_DIR'] . “/remote/barcode/$child_dir/”;
//$url = $server['http_image'] . “/remote/campaign/panasonic/image/$child_dir/”;

if (!file_exists($path)) {
mkdir($path);
chmod($path, 0755);
}

$image = “4537715333698.png”;
$path .= $image;

move_uploaded_file($image['tmp_name'], $path);

相关内容:

Leave a comment

1 Comments.

  1. 我正在找php上传图片的代码呢,学习了。
    博主的博客主题很漂亮。

发表评论

您的电子邮箱不会被公开。 标记为 * 的区域必须填写

*


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

有人回复时邮件通知我