![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi guys, This is fairly new grounds to me, and am banging my head against the walls with the following problem. I have a form with a file button (multipart encoded) witch uploads a file. I would like that uploaded file to be caught by an rpc call and then passed on to a server side function. If I place the following code in different php pages, things work, BUT, when trying to use XMLRPC, nothing happens (i get a failed with 0 errors...) What did I do wrong? Tia, S. [form.php] .... <form id="form1" name="form1" enctype="multipart/form-data" method="post" action="?do=upload"> <p> <input name="file" type="file" id="file" size="40" /> </p> <p> <label> <input type="submit" name="button" id="button" value="Submit" /> </label> </p> </form> .... <?php $client = new IXR_Client('http://my.site.com/xmlrpc.php'); $client->debug = true; $DO_UPLOAD = 1; if($_GET['do']=='upload'){ if($DO_UPLOAD == 1){ if (!$client->query('test.sendFile', $_FILES["file"])) { die($client->getErrorCode() . ' : '.$client- >getErrorMessage()); } else{ echo $client->getResponse(); } } else{ echo "<br />no uploads for you. (status=$DO_UPLOAD)"; } } ?> [xmlrpc.php] include_once('/functions.php'); .... $this->addCallback( 'test.sendFile', 'this:sendFile', array('struct', 'struct'), 'Returns Bool' ); .... function sendFile($payload){ $USER = "test"; $location = ABSPATH . "uploads/" . $USER . "/"; $val = receiveStructFile($payload, $location); return $val; } [functions.php] .... function receiveStructFile($payload, $location){ $target_path = $location . basename($payload['name']); $_FILES['file'] = $payload; if($msg = move_uploaded_file($_FILES['file']['tmp_name'], $target_path)){ $msg = "done"; } else{ $msg = $_FILES['file']['tmp_name'] . " failed with error: " . $_FILES['file']['error']; } return $msg; } | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: files, ixr, uploading, xmlrpc |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Uploading by FTP and line ending settings | dorayme | PHP | 1 | 05-20-2007 5:33 PM |
| Uploading files with IXR (XMLRPC) | soraya_soch@yahoo.com | PHP | 0 | 05-20-2007 5:33 PM |
| bin & cue files , | spot516 | Computer Consoles | 1 | 05-08-2007 4:55 AM |
| Role of psd files in web design | marketraise int | Website Coding | 0 | 05-03-2007 3:02 PM |
| Does anyone know how to make .dll files? | Mattster | Windows | 8 | 04-05-2006 12:25 AM |
| Featured Websites | ||||
|