Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to upload file using box.net API?
    text
    copied!<p>Form last 2 days i am trying to fix a issue of uploading a file in Box.net using php.</p> <p>I have gone through Box.net API Documentation and copied the sample code they have given, the code that they have given- uploads file perfectly, But it redirects to that page where server response is printed(XML response).</p> <p>I do not want to show user such screen, instead i would like to read those data and based on that response, display message of mine.</p> <p>I have edited my code as per the guidance given by @GBD, now i am facing another issue.</p> <p>The file I select does not upload , Instead it uploads some <code>.tmp file</code>. And when i hard code the file path in <code>$_POST['new_file1']</code> it successfully uploads correct file. the file path i get is some thing like this <code>C:\wamp\tmp\php1A.tmp</code> not actual file path, when i echo <code>$_FILES['new_file1']['tmp_name']</code>.</p> <p>Can any one tell me how can i get the file path from <code>$_FILES</code> ? So that i can pass it to $post</p> <p>Following is my code:</p> <pre><code>&lt;?php $upload_url = 'https://upload.box.net/api/1.0/upload/i9g1fmnnddfdr4739sxvbpXXXXXXXX/480416060'; $tmpfile = $_FILES['new_file1']['tmp_name']; $filename = basename($_FILES['new_file1']['name']); $_POST['new_file1'] = '@'.$tmpfile; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); $response = curl_exec($ch); curl_close($ch); echo $response; ?&gt; &lt;form action="" enctype="multipart/form-data" accept-charset="utf-8" method="POST"&gt; &lt;input type="file" name="new_file1" /&gt; &lt;input type="text" name="share" value="1" /&gt; &lt;input type="submit" name="upload_files" value="Upload File" /&gt; &lt;/form&gt; </code></pre> <p>Please help me out. </p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload