fungusanthrax fungusanthrax - 1 year ago 67
PHP Question

Get Pathway From PHP Upload

I have looked around for a solution and have found several of the same brand, but I can't seem to get an exact solution.

I want the image to display, which, in some sense works-partly. It uploads, but no image is displayed. What is the meaning of this?

Here is my PHP code:

echo <<<_END
<html><head><tite>PHP Form Upload</title></head><body>
<form method='post' action='login.php' enctype='multipart/form-data'>
Select file: <input type ='file' name='filename' size='10'/>
<input type='submit' value='upload'/>
$name = $_FILES['filename']['name'];
echo "Uploaded image '$name' <br /> <img src='$name' />";
echo "pathway " . $_FILES['filename']['tmp_name'];
echo "</body></html>";

Here is my error:

Failed to load resource: the server responded with a status of 404 (Not Found)

Logically, this doesn't make sense to me since when the page is uploaded, my code redirects to the same page and uploads the image with the correct pathway from tmp_name. Well let me know guys

This is what it looks like on the client-side: enter image description here

You cna try it here:

Answer Source

your move_uploaded_file($FILES['filename']['tmp_name'],$name); should be move_uploaded_file($_FILES['filename']['tmp_name'],$name); .

Underscore is missing.