Skip to content Skip to sidebar Skip to footer

How To Upload File Using Php

plz help me I dont know how to make this work
Your Photo:

Solution 1:

Can u try it?

$path = $_FILES['file']['name'];
if (file_exists($path)) {
    echo'File already exists!';
} else {
    move_uploaded_file($_FILES['file']['tmp_name'], $path);
}

Solution 2:

I think you are missing something like this:

  move_uploaded_file($_FILES["file"]["tmp_name"],
  "../img/profiles/" . $_FILES["file"]["name"]);
  echo"Stored in: " . "../img/profiles/" . $_FILES["file"]["name"];

Solution 3:

use move_uploaded_file(file,location)

you need to change your file field name to file instead photo

<inputtype="file" name="file" size="25" />

if don't change than use code like below to upload it.

move_uploaded_file($_FILES["photo"]["tmp_name"], "location/to/save/photo/with/extension");

Solution 4:

<inputtype="file" name="photo" size="25" />

should be like

<inputtype="file" name="file" size="25" />

because you are looking for $_FILES["file"] not $_FILES["photo"];

make change to either your input name or the $_FILE[] as you wish.

Post a Comment for "How To Upload File Using Php"