<html><head><title>Uploading Pictures</title></head>
<body bgcolor="lavender">
<h3>Uploading Files</h3>
<form
enctype="multipart/form-data"
action="upload_move_file.php"
method="post">
Browse and select the picture you want to upload: <br />
<input name="picture_file" type="file" />
<br />
<input type=submit value="Get File"/>
</form>
</body>
</html>
(The PHP Script)
<html><head><title>File Uploads</title></head>
<body bgcolor="#33ff33">
<font face="verdana" size="+1">
<?php
echo "The uploaded file is: ", $_FILES['picture_file']
['tmp_name'], "<br />";
$filename=$_FILES['picture_file']['name'];
$filesize=$_FILES['picture_file']['size'];
$directory='C:\wamp\www\examples\\';
$uploadFile = $directory . $filename;
echo "The moved file is: $uploadFile<br />";
if (move_uploaded_file($_FILES['picture_file']['tmp_name'],$uploadFile)){
echo "The file is valid and was successfully uploaded.<br /> ";
echo "The image file, $filename, is $filesize bytes.<br/>";
}
?>
<center>
<br />
<img src=<?php echo "\"\examples\\$filename\"";?>
width="250" height="175" border="3">
</center>
</font>
</body>
</html>
我编写了 html 和 php 代码来创建一个简单的上传文件表单。此代码用于将文件从同一台计算机上传到 localhost,但是如何将其更改为从 Google 图片上传?