2010-01-27 61 views

回答

1

試試這個教程: http://www.tizag.com/phpT/fileupload.php

HTML:

<form enctype="multipart/form-data" action="uploader.php" method="POST"> 
<input type="hidden" name="MAX_FILE_SIZE" value="100000" /> 
Choose a file to upload: <input name="uploadedfile" type="file" /><br /> 
<input type="submit" value="Upload File" /> 
</form> 

PHP:

$target_path = "uploads/"; 

$target_path = $target_path . basename($_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { 
    echo "The file ". basename($_FILES['uploadedfile']['name']). 
    " has been uploaded"; 
} else{ 
    echo "There was an error uploading the file, please try again!"; 
} 
+0

不,它應該是一個純PHP解決方案 – user260019 2010-01-27 13:48:57

+0

然後在你的問題中更具體一些...你可以使用cURL(http://php.net/manual/en/book.curl.php)。 – AlexV 2010-01-27 13:50:55

相關問題