增加php上传脚本

This commit is contained in:
luoliangyi 2023-11-10 14:13:35 +08:00
parent e018ad18f8
commit 4518cef23d
3 changed files with 29 additions and 6 deletions

View File

@ -185,9 +185,9 @@
req1.image_path = message['image_path'];
socket.send(JSON.stringify(req1));
var req2 = {'func':'upload_local_file', 'iden':'111', 'file_path':'', 'upload_mode':'http', 'http_host':'192.168.100.148', 'http_port':8001};
req2.file_path = message['image_path'];
socket.send(JSON.stringify(req2));
//var req2 = {'func':'upload_local_file', 'iden':'111', 'file_path':'', 'upload_mode':'http', 'http_host':'192.168.100.70', 'http_port':8001, 'http_path':'/upload.php'};
//req2.file_path = message['image_path'];
//socket.send(JSON.stringify(req2));
var req3 = {'func':'delete_local_file', 'file_path':''};
req3.file_path = message['image_path'];
@ -393,11 +393,12 @@
{
socket.send(JSON.stringify({
'func':'upload_local_file',
'file_path':'D:\\1.jpg',
'file_path':'D:\\5.jpg',
'remote_file_path':'/savedir/123.jpg',
'upload_mode':'http',
'http_host':'192.168.100.148',
'http_port':8001
'http_host':'192.168.1.70',
'http_port':8001,
'http_path':'/upload.php'
}));
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<title>Upload</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="filename"/>
<input type="submit" value="submit"/>
</form>
</body>
</html>

View File

@ -0,0 +1,9 @@
<?php
$file=$_FILES['filename'];
$fileName=$file['name'];
move_uploaded_file($file['tmp_name'],$fileName);
echo "<img style='width:500px' src='$fileName'>";
?>