![Please give me some advice, php handles multiple file upload errors.](https://www.1024programmer.com/wp-content/themes/iux/thumb.php?src=https://www.php1.cn/img/2014/10/08/13550296.png&w=300&h=193)
Please give me some advice, php handles multiple file upload errors.
Please give me some advice. There is an error when php handles multiple file uploads. I am new to php. I found a piece of code on the Internet for HTML to upload multiple files and php to handle uploaded files. After debugging, there is no problem with single file upload, but multiple file uploads keep getting errors. I don’t know. Where is the mistake? Please give me some advice1. Upload code Please select the location of the file: 2. Server-side php code header(‘Content- Type:text/html;charset=utf-8’);$fileArray = $_FILES[‘file’];//Get information about multiple files, note: the key name here does not contain []$upload_dir = ‘./upload/’; //The directory where uploaded files are savedforeach ( $fileArray[‘error’] as $key => $error) { if ( $error = = UPLOAD_ERR_OK ) { //PHP constant UPLOAD_ERR_OK=0, indicating no error in uploading $temp_name = $fileArray[‘tmp_name’][$key]; $file_name = $fileArray[‘name’][ $key]; move_uploaded_file($temp_name, $upload_dir.$file_name); echo ‘Upload [file’.$key.’] successful!’; }else { echo ‘Failed to upload [file’.$key.’]!’; }} 3. Error Phenomenon——Solution Idea- ———————$fileArray = $_FILES[‘file’] changed to $fileArray = $_FILES[‘myfile’]
![CI / CD /CD Continuous Integration Continuous Delivery Continuous Deployment](https://www.1024programmer.com/wp-content/uploads/2023/09/ddcc574beb16294e-168-300x193.jpeg)
PHP problem, please give me some advice
php Write your review! Come on, watch it all Member login | User registration Recommended reading io CI / CD /CD Continuous Integration Continuous Delivery Continuous Deployment CICDCDContinuous IntegrationContinuous DeliveryContinuous DeploymentWhat is CICD? What does it do?CIcontinuousintegrationContinuous integrationCDcontinuousdeliveryContinuous deliveryCDconti… [detailed] Crayon Shin-chan 2023-09-11 04:46:44 format lamp+nginx agent+discuz+wordpress+phpmyadmin setup error_log/usr/local/nginx/logs/nginx_error.logcrit;pid/usr/local/nginx/logs/nginx.pid; … [detailed] Crayon Shin-chan 2023-09-11 04:41:12
Please give me some advice, there is an error when php handles multiple file uploads.
I am new to PHP, and I found a piece of code on the Internet to upload multiple files in HTML and process the uploaded files in PHP. After debugging, there is no problem in uploading single files, but uploading multiple files keeps getting errors. I don’t know where the error is. Please give me some advice 1. Upload code Please select the location of the file: 2. Server-side php code header(‘Content-Type:text/html;charset=utf-8’);$fileArray = $_FILES[‘file’]; //Get information about multiple files. Note: the key name here does not include []$upload_dir = ‘./upload/’; //The directory where uploaded files are saved foreach ( $fileArray[ ‘error’] as $key => $error) { if ( $error == UPLOAD_ERR_OK ) { //PHP constant UPLOAD_ERR_OK=0, indicating that there is no error in uploading $temp_name = $fileArray[‘tmp_name’][$key]; $ file_name = $fileArray[‘name’][$key]; move_uploaded_file($temp_name, $upload_dir.$file_name); echo ‘Upload [file’.$key.’] successful!’; }else { echo ‘Upload [file’.$key.’] failed!’; }} 3. Error phenomenon /> Reply to discussion (solution) Change $fileArray = $_FILES[‘file’] to $fileArray = $_FILES[‘myfile’] Thanks to Xiaofengfengxia, the problem is solved!
PHPexcelreader error, please give me some advice
php excel When using PHP excelreader to read excel, other files can be read normally, except for one excel that cannot be read Code require_once( ‘Excel/reader.php’); $data2 = new Spreadsheet_Excel_Reader(); $data2->setOutputEncoding(‘UTF-8’); $data2->read($fullpath1 ); $sheets = $data2->sheets; echo ‘ ‘; print_r($sheets); exit; The array cannot be obtained now The error message is Uninitialized string offset: 2037813039 Line Number: 485 Uninitialized string offset: 2037813040 Line Number: 485 Uninitialized string offset: 2037813041 Line Number: 488 Can any friend help me? Thank you Reply to the discussion (solution) What is the value of $fullpath1? ? ? What is the value of $fullpath1? ? ? sorry, this is the path after uploading the file to make sure there is no error echo and see again echo and see Let’s talk about it later The code has already reported an error. What should I echo? It seems that everything is wrong when reading. I am very depressed. There is only one excel that always cannot be read. It is obviously not a problem with PHP, but a problem with this excel Only one excel cannot be read It is obviously not a problem with PHP. It’s a problem with Excel Each department reports the same table,…
A piece of php code, the program can run, but my classmate said that there is a problem with my code, please give me some advice
Response content: There are too many places to complain: In fact, there is a better traversal function than scandir(), that is glob, at least two array_shift() and a record-prefixed $str are completely unnecessary. ms_sc() function does not have a return value, I don’t think I can echo all the subdirectories, at least I I didn’t see it, maybe I’m blind. This is the most worth complaining about. What happened to that explode? Finally, it is recommended to read the manual more. There are already many well-written codes in the manual. For example, the code written by scandir() is much more beautiful than yours. Then this code Just using glob() is one step less than the previous code, and the code is condensed and streamlined for fun: function r($d) { foreach(glob(“$d/*”) as $f) is_dir($f) ? r($f) : unlink($f); return rmdir($d); } First of all, don’t blame no one to answer you, no one should answer (except I happen to be idle right now..) Aside from other things, what happens if the variable names are all a, b, c, and d. . The variable name should be meaningful, at least it looks convenient It should be possible to get all subdirectory paths.…
I have a very basic doubt about PHP, please give me some advice.
A very basic problem with PHP, please give me some advice<?php $upfile=$_FILES[“upfile”];?> Upload File The above is the code Content, when I run the web page, I always get an error message from the $upfile=$_FILES[“upfile”]; line. What went wrong? ——Solution——————–Hmm… Actually, this is a prompt. It is an improvement of PHP after version 5.x. If you feel irritated, you can block it by turning off the error prompt in php.ini. Of course, I don’t recommend doing these tips. Therefore, such submitted value issues can be judged through isset. If it is a variable, it can be solved by initialization assignment.
A piece of php code, the program can run, but my classmate said that there is a problem with my code, please give me some advice
Response content: There are too many places to complain: In fact, there is a better traversal function than scandir(), that is glob, at least two array_shift() and a record-prefixed $str are completely unnecessary. ms_sc() function does not have a return value, I don’t think I can echo all the subdirectories, at least I I didn’t see it, maybe I’m blind. This is the most worth complaining about. What happened to that explode? Finally, it is recommended to read the manual more. There are already many well-written codes in the manual. For example, the code written by scandir() is much more beautiful than yours. Then this code Just using glob() is one step less than the previous code, and the code is condensed and streamlined for fun: function r($d) { foreach(glob(“$d/*”) as $f) is_dir($f) ? r($f) : unlink($f); return rmdir($d); } First of all, don’t blame no one to answer you, no one should answer (except I happen to be idle right now..) Aside from other things, what happens if the variable names are all a, b, c, and d. . The variable name should be meaningful, at least it looks convenient It should be possible to get all subdirectory paths.…
Xi’an Monthly 5000php I am 28 years old and want to change careers, please give me some advice
I’m in Xi’an, almost 5,000 a month now, and I’m doing php development. This period of time is quite tangled, I don’t know why the blood pressure is actually high after a few years of work, 130 – 90 . And during the Chinese New Year, my girlfriend proposed to go back to Baoji, saying that it was not interesting to be with me, and the two of us didn’t go out to play every day, even on weekends. Almost almost 4 years. Having had a good chat with her that night, I wonder if I should reset myself: 1. If you change jobs, you will always have to deal with people instead of computers all day long. 2. The salary may not be as high as it is now if I change jobs. If I work hard for a year or two, the salary can reach more than 6000-7000. But after thinking about it for a year or two, I will be in my 30s, yes Do you still have the energy to take this job? If you are not capable, the boss will not pay you so much. Let’s give some advice! Tangled. . . . . Keep…
![A piece of php code, the program can run, but the students said that the code has Question, please ask God for advice](https://www.1024programmer.com/wp-content/uploads/2023/09/7fe0f341ef6e7b93-300x193.jpeg)
A piece of php code, the program can run, but the classmate said that there is a problem with the code, please give me some advice
Back-end development | php tutorial php backend development-php tutorial interesting installment source code, vscode occupies the full screen, ubuntu replaces part File name, ngixn multiple tomcat, sqlite save time stamp, js front-end upload picture plugin, front-end framework starts from src, python mobile version can crawl, Tianxuetong php, niche product seo, resource sharing website, web streaming media playback Tool code, excellent login interface template free download lzw wx source code, compile vscode under linux, ubuntu 16 weather, input sentences in tomcat, crawler development c, php website hanging horse, Fujian official seo optimization welcome consultation, washing online banking website source code, Dongyi sitefactory template lzw reply content: jsp cinema system source code, ubuntu16 process, python video crawler system, desktop php source code, seo tutorial center lzw There are too many places to complain: In fact, there is a better traversal than scandir() Function, that is glob, at least two array_shift() and a record prefix $str are completely unnecessary. ms_sc()The function does not have a return value, I don’t think I can echo all the subdirectories, at least I didn’t see it, maybe I’m blind. This is the most worth complaining about. What happened to that explode? Finally, it is recommended to read…