Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 1:37 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Article
 Article subject: PHP HTML form with to file upload
PostPosted: Sun Oct 26, 2008 9:33 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2103
Location: Earth
Has thanked: 39 time
Have thanks: 57 time

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>

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Need to Display Content using JavaScript in HTML page  Scripting Language  stankov  0
 Configuring the header html font  HTML examples  msi_333  0
 multi-frameset and non-re-sizable html frame pages  HTML examples  msi_333  0
 getting gst, pst total to diplay in my javascript form  Scripting Language  Anonymous  0
 What are PHP,PSD to HTML ?  PHP  johnmccem  5

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 2 guests



Jump to:  
Previous Article | Next Article 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team