我的 HTML 代码
<form method="post" enctype="multipart/form-data" action="upload.php">
<input type="file" name='image' >
<input type="SUBMIT" value="Submit">
</form>
PHP 代码(只提到错误的那一行)
<?php
list($waste,$extension) = explode("/",$_FILES["image"]["type"]);echo $extension;
?>
如果文件是图像,它会给出文件扩展名,但如果是视频,它会给出错误。
错误
( ! ) Notice: Undefined index: image in D:\wamp\www\upload.php on line 3
Call Stack
# Time Memory Function Location
1 0.0007 364904 {main}( ) ..\upload.php:0
( ! ) Notice: Undefined offset: 1 in D:\wamp\www\upload.php on line 3
Call Stack
# Time Memory Function Location
1 0.0007 364904 {main}( ) ..\upload.php:0
请告诉我如何使它也适用于视频上传。