国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - PHP教程 - php上傳圖片獲取路徑及給表單字段賦值的方法

php上傳圖片獲取路徑及給表單字段賦值的方法

2020-12-18 15:405iasp PHP教程

這篇文章主要介紹了php上傳圖片獲取路徑及給表單字段賦值的方法,涉及PHP文件傳輸與表單操作相關技巧,需要的朋友可以參考下

本文實例講述了php上傳圖片獲取路徑及給表單字段賦值的方法。分享給大家供大家參考,具體如下:

1. 調用方法例子:

大圖路徑:

?
1
2
<input type="text" name="bigImageURL" id="bigImageURL" value="">
<iframe src="uppic.php?id=bigImageURL" width="600" height="25" frameborder="0" scrolling="no"></iframe>

小圖路徑:

?
1
2
<input type="text" name="smallImageURL" id="smallImageURL" value="">
<iframe src="uppic.php?id=smallImageURL" width="600" height="25" frameborder="0" scrolling="no"></iframe>

2. uppic.php

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
header("Content-Type:text/html;charset=GB2312");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>圖片上傳</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.3790.4275" name=GENERATOR>
<style type="text/css">
<!--
input{border-width:1px;border:1px solid #bdbcbd;padding:3px 0 3px 5px;}
.inputbut{padding-left:3px;padding-right:2px;border:1px solid #bdbcbd;background:#FFF url(../images/inputbut_bg.gif) left center repeat-x;font-size:12px;height:24px;}
-->
</style>
</HEAD>
<BODY leftmargin=0 topmargin=0 style="font-size:12px">
<?php
$id=$_GET["id"];
//echo "id==".$id;
switch($_GET["action"])
{
case "up":
 upmovie($id);
 break;
default:
 upinput($id);
 break;
}
function upinput($id){
?>
<SCRIPT language=javascript>
function check()
{
 var strFileName=document.form.strPhoto.value;
 if (strFileName=="")
 {
  alert("請選擇要上傳的文件");
 document.form.strPhoto.focus();
  return false;
 }
 return true;
}
</SCRIPT>
<form action="uppic.php?action=up&id=<?=$id?>" enctype="multipart/form-data" name="form" method="post" onsubmit="if (!check()) return false;">
<input name="strPhoto" type="file" id="strPhoto" size="40">
<input type="submit" name="Submit" value="上 傳" class=inputbut />
</form>
</BODY>
<?php
}
function upmovie($id){
 global $web_picdir;
 $savePath=dirname(__FILE__)."/".$web_picdir;
 $str = date('YmdHis');
 if($_FILES['strPhoto']['name']!='')
 {
 $tmp_file=$_FILES['strPhoto']['tmp_name'];
 $file_types=explode(".",$_FILES['strPhoto']['name']);
 $file_type=$file_types[count($file_types)-1];
 if(strtolower($file_type)!="jpg"&strtolower($file_type)!="gif"&strtolower($file_type)!="bmp"&strtolower($file_type)!="png"){
  echo "<span style=/"color:red;line-height: 25px;/">格式錯誤請重新上傳<a href=# onclick=history.go(-1);>[返回]</a></span>";
  exit;
 }
 $file_name=$str.".".$file_type;
 if(!copy($tmp_file,$savePath.$file_name)){
 echo "<span style=/"color:red;line-height: 25px;/">上傳錯誤請重試!!<a href=# onclick=history.go(-1);>[返回]</a></span>";
 }else{
 //echo "<span style=/"olor:red;line-height: 25px;/">上傳成功</span><script>parent.document.getElementById(/"bigImageURL/").value=/"".$file_name."/"</script>";
 echo "<span style=/"olor:red;line-height: 25px;/">上傳成功</span><script>parent.document.getElementById(/"{$id}/").value=/"".$file_name."/"</script>";
 echo "<a href=# onclick=history.go(-1);>,若需要修改,請重新上傳</a>";
 }
 }else{
 echo "<span style=/"color:red;line-height: 25px;/">請選擇需要上傳的文件<a href=# onclick=history.go(-1);>[返回]</a></span>";
 }
}
?>

注意: 不同的文本框 需要定義id,  iframe url :   uppic.php?id=文本框id

希望本文所述對大家PHP程序設計有所幫助。

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 成人免费视频网站在线观看 | 午夜精品网站 | 免费毛片网站 | 久久思久久 | 午夜成人免费视频 | 激情一区 | 欧美久久精品一级黑人c片 成人在线视频免费观看 | 欧美一级大片 | 亚洲经典一区 | 一区二区高清 | 毛片黄片免费观看 | 毛片一级av | 国产人免费人成免费视频 | 亚洲精品一区二区网址 | 国产一区二区在线免费观看 | 精品国产免费久久久久久尖叫 | 成人免费视频008 | 成人精品在线观看 | 中文久久精品 | 日韩精品免费视频 | 久久中文字幕一区 | 久久久亚洲精 | 欧美在线观看一区 | 一区二区三区在线看 | 国产精品久久久久久久9999 | 欧美精品一区二 | 成人欧美一区二区三区视频xxx | 日韩av一区二区在线观看 | 日韩成人一区二区 | 综合色久 | 日韩不卡 | 日韩中文字幕在线视频 | 自拍第1页 | 欧美日韩在线精品 | 国产精品成人av | 国产成人毛片 | 91福利资源站 | 国产精品99精品久久免费 | 激情网页 | 26uuu成人免费毛片 | 欧美激情免费 |