Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Uploading Issue
    primarykey
    data
    text
    <p>I've worked with a few scripts to begin uploading files on my development machine. Problem is, despite the expected ease of this operation, Apache seems to time-out whenever I try to upload an image. Uploading is set to <code>On</code> and the <code>tmp</code> directory is set in <code>php.ini</code>.</p> <p>I tried uploading the main <code>gif</code> from Google, an <code>8.36KB</code> image. It should be fine and well within the limits to PHPs uploading capabilities.</p> <p>Here is a copy of the script. There should be an easy fix. As requested, I changed the tilde to an actual directory.</p> <pre><code>&lt;?php if (!isset($_GET['upload'])) { ?&gt; &lt;form method="post" action="index.php?upload=true" enctype="multipart/form-data"&gt; &lt;input type="file" name="file" class="form"&gt; &lt;input name="submit" type="submit"&gt; &lt;/form&gt; &lt;? } else if (isset($_GET['upload']) &amp;&amp; $_GET['upload'] == 'true') { $url = $_FILES['file']['name']; $move = move_uploaded_file($_FILES['file']['tmp_name'], "/Users/&lt;username&gt;/Sites/file.jpg"); if ($move) { echo "Success!"; } else { echo "Err..." } } ?&gt; </code></pre> <p>Thanks, Dan</p> <p>EDIT:</p> <p>I fixed it, with help from a few of the answers, to one of which I will mark.</p> <p>A few things here were causing this behavior.</p> <ol> <li><p>Permissions on the <code>images</code> directory were not set to allow the <code>_www</code> user to access it. A <code>chmod -R 777 images</code> seemed to fix it, as well as a <code>sudo chown _www images</code>.</p></li> <li><p>The form output may have been corrupting the PHP script itself. As suggested, an <code>ECHO &lt;&lt;&lt; ...END</code> helped, I think.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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