-1

撮影した写真を PHP サーバーにアップロードする必要がありますが、この画像 (ビットマップ) と名前やログインなどのその他の情報を渡し、$_FILES[] を使用してサーバー側で取得する方法がわかりません。

前もって感謝します。

4

1 に答える 1

0
 $target = "folder_name/"; 

 $target = $target . basename( $_FILES['uploaded']['name']) ; 
 $ok=1; 
 echo "<pre>"; print_r($_FILES);echo "</pre>";
 echo $target."<br>";
 $uploaded_size=$_FILES['uploaded']['size'];
 $uploaded_type=$_FILES['uploaded']['type'];
 //This is our size condition 
 if ($uploaded_size > 350000) 
 { 
 echo "Your file is too large.<br>"; 
 $ok=0; 
 } 

 //This is our limit file type condition 
 if ($uploaded_type !="image/bmp") 
 { 
 echo "No PHP files<br>"; 
 $ok=0; 
 } 

 //Here we check that $ok was not set to 0 by an error 
 if ($ok==0) 
 { 
 echo "Sorry your file was not uploaded"; 
 } 

 //If everything is ok we try to upload it 
 else 
 { 
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
 { 
 echo "<b>The file ". basename( $_FILES['uploaded']['name']). " has been uploaded</b>"; 
 } 
 else 
 { 
 echo "Sorry, there was a problem uploading your file."; 
 } 
 } 
于 2013-02-06T12:02:30.177 に答える