Home > Article > Web Front-end > Ajaxupload implements multiple file upload operations
This time I will bring you Ajaxupload to implement multiple file upload operations. What are the precautions for Ajaxupload to implement multiple file upload operations? The following is a practical case, let’s take a look.
Without further ado, I will post the code directly for you. The specific code is as follows:
<pre name="code" class="php"><?php $ele = $_GET['ele']; $file = $_FILES['thumb_'.$ele]; $pathinfo = pathinfo($file['name']); $filedir = 'uploads/' . date('Y'); if (!is_dir($filedir)) { mkdir($filedir); } $filedir .= '/' . date('md'); if (!is_dir($filedir)) { mkdir($filedir); } $filedir .= '/' . time() . '_' . mt_rand(1000, 9999) . '.' . $pathinfo['extension']; $msg = ''; if (!move_uploaded_file($file['tmp_name'], $filedir)) { $msg = '上传失败'; } $data = array('msg' => $msg, 'filedir' => $filedir); sleep(2); echo json_encode($data); ?>
I believe you will read the case in this article You have mastered the method. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Asynchronous implementation of ajax file upload form
Asynchronous implementation of ajax file download
The above is the detailed content of Ajaxupload implements multiple file upload operations. For more information, please follow other related articles on the PHP Chinese website!