views:

44

answers:

4

Is it possible to do it with PHP?

Best with a simple demo!

+1  A: 

Yes, it is possible. See handling file uploads in the PHP manual.

Pekka
A: 

http_post_fields() looks promising.

Ignacio Vazquez-Abrams
Yes, but PECL pecl_http >= 0.10.0
Gordon
+1  A: 

Try this tutorial: 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!";
}
AlexV
No,it should be a pure PHP solution
Then be more specific in your question... You could then use cURL (http://php.net/manual/en/book.curl.php).
AlexV