Total members 11894 |It is currently Thu Nov 21, 2024 12:29 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





This is HTML and php form to upload files :
Code:
<html>
<head>
 <title>Upload Form</title>
</head>
<body>
<form action="UploadSingle.php" method="post" enctype="multipart/form-data">
 Upload a file: <input type="file" name="thefile"><br><br>
 <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>


<!--
<?php
 $aErrors 
= "";
 if ( !empty( $thefile_name ) ) // no file selected
 {
 if ( ( $thefile_type == "image/gif" ) ||
 ( $thefile_type == "image/pjpeg" ) ||
(
 $thefile_type == "image/jpeg" ) ){
 if ( $thefile_size < ( 1024 * 100 ) ){
 $aCurBasePath = dirname( $PATH_TRANSLATED );
 $aNewName = $aCurBasePath . $thefile_name;
 copy( $thefile, $aNewName );
 } else {
 $aErrors .= "The file was too big";
}
 } else {
 $aErrors .= "The file was neither a gif nor a jpeg";
}
}
 else{
 $aErrors .= "No file was selected";
 }
?>
<html>
<head>
 <title>Display an Uploaded Image</title>
</head>
<body>
<?php
 if 
( $aErrors != "" ){
 print( "<b>There were errors</b>: $aErrors<br>" );
 } else {
 print( "The picture you uploaded:<br><br>" );
 print( "<img src=\"/$thefile_name\" border=\"0\">" );
 }
?>
</body>
</html>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : PHP HTML form with to file upload
 Upload Form     -  
 form to insert data, upload many files and images , database     -  
 Upload PDF file in php     -  
 JSP to Upload File     -  
 File Upload in JSP     -  
 Upload PHP file code     -  
 upload file in ajax     -  
 Upload File to a new directory     -  
 Struts2 upload file and ajax     -  
 HTML registration form example     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com