Five minutes to solve the PHP file upload code demonstration. When learning PHP, you may encounter PHP file upload problems. here we will introduce the detailed PHP file upload code to solve this problem. here we will share it with you. When you are very familiar with php syntax, you may encounter PHP file upload problems. here we will introduce the detailed PHP file upload code to solve this problem. I will share it with you here. The syntax of php is very simple. it is its simplicity that makes it the first programming language on the Internet.
You don't need to have a lot of knowledge to get started. for example, if you are learning C language, you must have a good understanding of how variables are defined, how pointers are operated, and how memory is created and destroyed. For example, if you want to learn the Java language, you must have the foundation of object-oriented (OO). then you must know when encapsulation is required, when inheritance is required, and when polymorphism is required, to do a project, you must understand SSH. Most PHP users may not be so specific at all. some users prefer process-oriented, so you can write code in process-oriented mode. some users prefer object-oriented, then you can write code in an object-oriented way. The emergence of Php is due to the Internet, and is currently the first programming language of Internet Web. Satisfying user needs is always the first, and maintainability can be placed in the second place. We usually say that Web applications are always beta, and the plan is far from changing rapidly.
- >
- <HtmlxmlnsHtmlxmlns=Http://www.w3.org/1999/xhtml">
- <Head>
- <Metahttp-equivMetahttp-equiv= "Content-Type"Content= "Text/html;Charset=Gb2312"/>
- <Title>Untitled Document Title>
- Head>
-
- <Body>
- <FormenctypeFormenctype= "Multipart/form-data"Action= "Upload. php"Method="Post">
- <InputtypeInputtype= "Hidden"Name= "Max_file_size"Value=300000>
- <InputnameInputname= "Userfile"Type= "File">
- <InputtypeInputtype="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 successful! ");
- Print_r ($ _ FILES );
- }
- Else
- {
- Print ("Upload failed! ");
- Print_r ($ _ FILES );
- }
- Print" Pre>";
- ?>
The above is the detailed PHP file upload code, and I hope to help you.
Bytes. Php syntax is very...