When learning PHP, you may encounter PHP upload file problems, here will introduce the detailed PHP upload file code to solve this problem, here to take out and share with you. PHP's syntax is very simple, it is the simplicity of it, making it the current Internet first programming language.
You do not need to have a lot of knowledge to get started, such as: You learn C language, you must have a good understanding of how each variable is defined, how the pointer is manipulated, how memory is created and destroyed, and so on. Another example: You learn the Java language, you must have an object-oriented (OO) Foundation, it must be clear when you need to encapsulate, when to inherit, when the need for polymorphism, to do the project, how to understand the point of SSH. Most users of PHP may not have so much to pay attention to, some people like process-oriented, you write code in a process-oriented way, some people like object-oriented, then you write code in an object-oriented way. PHP is due to the Internet, is currently the Internet Web2.0 first programming language. Meet user needs is always the first, maintainability can be placed in the second place. We often say that Web applications are always beta, and the plans are far from changing.
- >
- < Htmlxmlns Htmlxmlns = "http://www.w3.org/1999/xhtml" >
- <head>
- < metahttp-equiv metahttp-equiv = "Content-type" content = "text/html; CharSet = gb2312 " />
- < title > Untitled Document title>
- head>
- <body>
- < Formenctype Formenctype = "Multipart/form-data" Action = "upload.php" Method = "POST" >
- < InputType InputType = "hidden" name = "Max_file_size" value = 300000 >
- < InputName InputName = "UserFile" type = "File" >
- < InputType InputType = "Submit" >
- form>
- body>
- html>
- upload.php
- php
- $ Uploaddir = "c \" ;
- $ UploadFile = $uploaddir. $_files[' userfile ' [' name '];
- print " <pre> ";
- if (Move_uploaded_file ($_files[' userfile ' [' tmp_name '], $uploadfile))
- {
- Print ("Upload succeeded!");
- Print_r ($_files);
- }
- Else
- {
- Print ("Upload failed!");
- Print_r ($_files);
- }
- print " pre> ";
- ?>
The above is the detailed PHP upload file code, we hope to be helpful.
http://www.bkjia.com/PHPjc/446553.html www.bkjia.com true http://www.bkjia.com/PHPjc/446553.html techarticle When learning PHP, you may encounter PHP upload file problems, here will introduce the detailed PHP upload file code to solve this problem, here to take out and share with you. PHP's syntax is very ...