Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP File Uploading
    text
    copied!<p>I'm getting index not found errors on a processing page for $_FILES. So far as I know my code is technically correct (at least the two other people who've looked at it can't find any errors either).</p> <p>So first, the function that is called that displays the form with the file upload:</p> <pre><code>function portfolioEditor($p) { echo "&lt;form method=\"post\" action=\"" . siteurl . "/manage/update.php\"&gt;"; echo '&lt;input type="text" name="name" id="name" class="grid4 first" value="' . $p['name'] . '" /&gt;'; echo '&lt;input type="text" name="posttype" id="posttype" class="grid4" value="' . $p['posttype'] . '" /&gt;'; echo "\n&lt;br /&gt;\n"; echo '&lt;textarea name="content" id="content" class="grid8 first"&gt;' . $p['content'] . '&lt;/textarea&gt;'; echo "\n&lt;br /&gt;\n"; echo '&lt;input type="hidden" name="MAX_FILE_SIZE" value="30000" /&gt;'; echo '&lt;input name="file" value="' . $p['image'] . '" id="file" type="file" /&gt;'; echo '&lt;input type="submit" value="Submit" name="submit" id="submit" /&gt;'; echo '&lt;input type="hidden" value="true" id="fileup" name="fileup" /&gt;'; echo '&lt;/form&gt;'; } </code></pre> <p>(take it as a given that the page with the form calls portfolioEditor($p) with details for $p filled in, or blanks for a new item.)</p> <p>This is the update page (without the database insert yet)</p> <pre><code>$p = $_POST; $p['url'] = str_replace(" ", "-", $p['name']); foreach ($p as $k =&gt; $v) { $p[$k] = addslashes($v); //echo $v; } // FILE UPLOAD IF NEEDED if(isset($p['fileup']) &amp;&amp; $p['fileup'] == "true") { $loc = sitepath . "/files"; $loc = $loc . basename( $_FILES['file']['name']); move_uploaded_file($_FILES['file']['tmp_name'], $loc); } </code></pre> <p>I have no idea why this isn't working, every resource I've seen on writing your own upload script uses almost the exact same code.</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