一段下传图片,并在MYSQL中记录路径的代码求指正
程序员文章站
2022-04-25 17:18:34
...
一段上传图片,并在MYSQL中记录路径的代码求指正
只上传一张图片的功能已经实现,上传两张图片就实现不了,代码段比较简单,麻烦大家指导一下:
上传图片的表单:
上传程序:uploadclass.php(此程序只能上传图片1,如果要能上传图片2,需要怎么加代码呢?)
------解决方案--------------------
只上传一张图片的功能已经实现,上传两张图片就实现不了,代码段比较简单,麻烦大家指导一下:
上传图片的表单:
- PHP code
window.alert('congratulations,the product data inserted successful');location.href='index.php'";} mysql_close();}?>Administrator for upload the product resource
上传程序:uploadclass.php(此程序只能上传图片1,如果要能上传图片2,需要怎么加代码呢?)
- PHP code
return and try again?click me";exit;}else{$filename=explode(".",$_FILES['file']['name']);do{$filename[0]=random(10); $name=implode(".",$filename);//$name1=$name.".Mcncc";$uploadfile=$uploaddir.$name;}while(file_exists($uploadfile));if (move_uploaded_file($_FILES['file']['tmp_name'],$uploadfile)){if(is_uploaded_file($_FILES['file']['tmp_name'])){echo "the Images Upload failed!";}else{echo "Your file has been uploaded: ";echo " Continue to upload ";}}}?>
------解决方案--------------------