0

I´m trying to create a form in HTML5 to upload a file to the server. My HTML code is the following

<form action='upload.php' method='post' enctype='multipart/form-data'>
  Select file to upload:
  <input type='file' name='fileToUploadNep'>
  <input type='submit' value='submit'></form>;

but as output i get this

enter image description here

there is no way to select the file from the harddisk. can someone please help me ?

3
  • I'm not able to reproduce your issue. What browser are you using? Is there any odd styling going on? Commented Jul 1, 2018 at 6:37
  • I have copied your markup into a snippet into the question, so that you can run it and confirm that it is identical to the screenshot you linked to. Feel free to edit the snippet in order to reproduce the issue. Commented Jul 1, 2018 at 6:43
  • Hi. thanks for the fast reply. You are right. I have the following style "input[type='file'] {display: none;}" that I cannot remove because of another input form. How can I solve my problem ? Commented Jul 1, 2018 at 6:50

2 Answers 2

1

Use inner CSS style like this:

<form action='upload.php' method='post' enctype='multipart/form-data'>
  Select file to upload:
  <input type='file' name='fileToUploadNep' style="display:block" >
  <input type='submit' value='submit'></form>
Sign up to request clarification or add additional context in comments.

Comments

1

This maybe an error with your web browser. The code is working perfectly on my web browser. Just tried it on Chrome web browser. I don't know why you added that semi-colon at the end of your code:

<form action='upload.php' method='post' enctype='multipart/form-data'>
  Select file to upload:
  <input type='file' name='fileToUploadNep'>
  <input type='submit' value='submit'></form>

; The code is working properly. Ask the developer of your web browser. Screenshot, taken from my computer... If you have another form on the web page and wants to hide one of it's input element, just simple hidden class to it and in your CSS file, add .hidden{display: none} and that's all! or, the simplest way is to add an inline style to the input.file element. It'll override the style, written on your CSS file. Sample: <input type='file' name='fileToUploadNep' style="display: inline-block">

3 Comments

Hi. thanks for the fast reply. You are right. I have the following style "input[type='file'] {display: none;}" that I cannot remove because of another input form. How can I solve my problem ?
Edited the answer. Check it out.
Hi. style="display: inline-block" does the job. Thank a lot :)

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.