How To Write the FORM Tag Correctly for Uploading Files?

How To Write the FORM Tag Correctly for Uploading Files?

How To Write the FORM Tag Correctly for Uploading Files?

View Answers

November 12, 2010 at 4:04 PM

Write like this in ur programe


November 13, 2010 at 4:28 PM

Hi,

The "html" form code for uploading file is:

<html>
<body>

<form action="uploadfiles.php" method="post"
enctype="multipart/form-data">
<label>Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>

The uploadfiles.php code is:

<?php
if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {
  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  echo "Type: " . $_FILES["file"]["type"] . "<br />";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  echo "" . $_FILES["file"]["tmp_name"];
  }
?>

Thanks









Related Tutorials/Questions & Answers:
How To Write the FORM Tag Correctly for Uploading Files?
FORM Tag Correctly for Uploading Files.
Advertisements
uploading image in the form
how to write a jsp form using html
The form tag
HTML5 form example, How to implement form tag in html document.
Form Tag library configuration
HTML -- form tag.
java code for uploading a resume in a form - JSP-Servlet
Uploading file in servlet from a html form
Form Tag Example
Tomahawk inputFileUpload tag
How to create simple HTML Form?
Assign value from a <bean:write> tag to a variable
JSF form tag
eliminate the extra space after a </form> tag
How to write Java Program
How to write in File in Java
how to write in xml? - XML
How to write in File in Java
How to write into CSV file in Java
how to write code for this output?
How to write image in Jmagick
How to Write to file in Java?
how to write this program
How to write text on image
How to create form in Swings
Comparing arrays not working correctly?
How to reset a form in jQuery?
How to write calculator in J2ME program?
how to write servlet program in eclipse?
how to write store procedure in sql
How to write javascripts - JSP-Servlet
how to get UIView by tag
print selected checkbox names in array without form tag
Optiontransferselect Tag (Form Tag) Example
Reset Tag (Form Tag) Example
Select Tag (Form Tag) Example
How to write javascripts - JSP-Servlet
How to write to file using FileOutputStream
The input tag
The password tag
The checkboxes tag
The radiobutton tag
The radiobuttons tag
The select tag
The option tag
The options tag
The textarea tag
The errors tag

Ads