How To Upload File Using Php August 21, 2024 Post a Comment 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); } CopySolution 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"]; CopySolution 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" /> Copyif don't change than use code like below to upload it.move_uploaded_file($_FILES["photo"]["tmp_name"], "location/to/save/photo/with/extension"); CopySolution 4: <inputtype="file" name="photo" size="25" /> Copyshould be like<inputtype="file" name="file" size="25" /> Copybecause you are looking for $_FILES["file"] not $_FILES["photo"];make change to either your input name or the $_FILE[] as you wish. Share Post a Comment for "How To Upload File Using Php"
Post a Comment for "How To Upload File Using Php"