PHP image upload solution
PHP image uploadNotice: Use of undefined constant tmp_name – assumed ‘tmp_name’ in E:\www\30311\add.php on line 46 Warning: mkdir() [function.mkdir] : Permission denied in E:\www\30311\add.php on line 69 Notice: Use of undefined constant extension – assumed ‘extension’ in E:\www\30311\add.php on line 74 Warning: move_uploaded_file(upload/1331530339.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in E:\www\30311\add.php on line 82 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘C:\WINDOWS\Temp\php19E5.tmp’ to ‘upload/1331530339.jpg’ in E:\www\30311\add.php on line 82Error moving file! ——Solution——————–You didn’t set the permission to allow uploading. It said that your mkdir() was rejected and the extension was not opened. ——Solution——————–Notice : Use of undefined constant tmp_nameNote: Use of undefined constant tmp_name Solution: Add ‘tmp_name’ quotes to it. Or you can turn off the Notice error level by setting php.ini (you can use [tmp_name]). Warning: mkdir() [function.mkdir]: Permission deniedWarning: Access denied. Please confirm that you have permissions on the current directory. failed to open stream: No such file or directoryPlease check if there is any problem with the path.
PHP image upload solution
Uploading pictures in phpI want to preview it on the web page first. For example, if the picture I just uploaded is displayed on the web page, what should I do? Shouldn’t I echo ““;? Should I write it like this? How to write it? How to rewrite the code to name the picture using the upload time <?php if (is_uploaded_file($ _FILES[‘upfile’][‘tmp_name’])){ $upfile=$_FILES[“upfile”]; $name = $upfile[“name” ];$type = $upfile[“type”];$size = $upfile[“size”];https://www.php1.cn/detail/$tmp_name = $upfile[“tmp_name”];$error = $upfile[“error”]; switch ($type) {case ‘image/pjpeg’ : $ok=1; break;case ‘image/jpeg’ : $ok=1;break;case ‘image/gif’ : $ok=1;break; case ‘image/png’ : $ok=1;break;} if($ok && $error==’0′){ move_uploaded_file (https://www.php1.cn/detail/$tmp_name,’up/’.$name); echo “Upload successful”; echo “$name“; echo “$type” ; echo “$size“; echo “https://www.php1.cn/detail/$tmp_name“; }} ?> Upload file: ——Solution- —————— I seem to remember which post you asked this question in? I originally wanted to answer you this afternoon, but you ended up sending it here? How do you plan to express your time? Timestamp? Modify here//move_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$name);//Get the file extension$oldname=$upfile[ ‘name’];//Note the path included$fileexpand=pathinfo($oldname, PATHINFO_EXTENSION);$filename=strtotime();//Time stamp//$filename=date (‘YmdGis’);//Beijing timemove_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$filename.$fileexpand); ——Solution——————– move_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$filename.$fileexpand); This was incorrectly modified tomove_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$filename.’.’ .$fileexpand); The code given to you above is what you wantHow to rewrite the code to name the image using the upload time There is also a problem with displaying…
PHP image upload solution
PHP image uploadNotice: Use of undefined constant tmp_name – assumed ‘tmp_name’ in E:\www\30311\add.php on line 46 Warning: mkdir() [function.mkdir] : Permission denied in E:\www\30311\add.php on line 69 Notice: Use of undefined constant extension – assumed ‘extension’ in E:\www\30311\add.php on line 74 Warning: move_uploaded_file(upload/1331530339.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in E:\www\30311\add.php on line 82 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘C:\WINDOWS\Temp\php19E5.tmp’ to ‘upload/1331530339.jpg’ in E:\www\30311\add.php on line 82Error moving file! ——Solution——————–You didn’t set the permission to allow uploading. It said that your mkdir() was rejected and the extension was not opened. ——Solution——————–Notice : Use of undefined constant tmp_nameNote: Use of undefined constant tmp_name Solution: Add ‘tmp_name’ quotes to it. Or you can turn off the Notice error level by setting php.ini (you can use [tmp_name]). Warning: mkdir() [function.mkdir]: Permission deniedWarning: Access denied. Please confirm that you have permissions on the current directory. failed to open stream: No such file or directoryPlease check if there is any problem with the path.
PHP image upload solution
Uploading pictures in phpI want to preview it on the web page first. For example, what should I do if the picture I just uploaded is displayed on the web page? Shouldn’t I echo ““;? Should I write it like this? How to write it? How to rewrite the code to name the image with the upload time <?php if (is_uploaded_file($ _FILES[‘upfile’][‘tmp_name’])){ $upfile=$_FILES[“upfile”]; $name = $upfile[“name” ];$type = $upfile[“type”];$size = $upfile[“size”];https://www.php1.cn/detail/$tmp_name = $upfile[“tmp_name”];$error = $upfile[“error”]; switch ($type) {case ‘image/pjpeg’ : $ok=1; break;case ‘image/jpeg’ : $ok=1;break;case ‘image/gif’ : $ok=1;break; case ‘image/png’ : $ok=1;break;} if($ok && $error==’0′){ move_uploaded_file (https://www.php1.cn/detail/$tmp_name,’up/’.$name); echo “Upload successful”; echo “$name“; echo “$type” ; echo “$size“; echo “https://www.php1.cn/detail/$tmp_name“; }} ?> Upload file: ——Solution- —————— I seem to remember which post you asked this question in, right? I originally wanted to answer you this afternoon, but you ended up sending it here? How do you plan to express your time? Timestamp? Modify here//move_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$name);//Get the file extension$oldname=$upfile[ ‘name’];//Note the path included$fileexpand=pathinfo($oldname, PATHINFO_EXTENSION);$filename=strtotime();//Time stamp//$filename=date (‘YmdGis’);//Beijing timemove_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$filename.$fileexpand); ——Solution——————– move_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$filename.$fileexpand); This was incorrectly modified tomove_uploaded_file(https://www.php1.cn/detail/$tmp_name,’up/’.$filename.’.’ .$fileexpand); The code given to you above is what you wantHow to rewrite the code to name the image using the upload time There is also a problem of…