0

In an html file, I have:

<form action="save.php" method="post" >
<input type="file" name="file" id="file`enter code here`" />
<input type="submit" name="submit"  value="Save" />

So I need the path of the uploaded file to the save.php page, please guide me.

3
  • you can access file detail using $_FILES. Commented Aug 28, 2018 at 5:18
  • do you mean $_FILES['file']['tmp_name']? Commented Aug 28, 2018 at 5:18
  • yes , after that you have to pass that to move_uploaded_file() Commented Aug 28, 2018 at 5:20

1 Answer 1

1

The file won't be upload until you write PHP code in save.php file.

You will get values of selected file in $_FILES after submitting form data. Please use move_uploaded_file() PHP function to upload file.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Manish, thanks for your help. I need the current path file, not new location. Something like that "document.getElementById("file").value;" in Ajax but I haven't any idea haw can I use it in save.php file.
I try this in php file but it didn't work also: $dochtml = new DOMDocument(); $dochtml->loadHTML('C:\wamp64\www\opencaster\upload.html'); $elm = $dochtml->getElementById("file").value;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.