This article mainly introduced the jQuery Mobile + PHP file upload method as an example, and due to his negligence of problem solution, recommend to everybody here, friend in need under reference

simple of a small example jQuery Mobile + PHP by global $_FILES upload, then with the move_uploaded_file () method to upload pictures to move to the folder under the local server,

here is the HTML and PHP code


code is as follows:


<! DOCTYPE html>
<Html>
<Head>
                              <Meta charset="utf-8" >
                              <Link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" >
                              <Script SRC="http://code.jquery.com/jquery-1.8.3.min.js" ></script>
                              <Script SRC="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js" ></script>
</head>
<Body>
              <Div data - role="page" id="upload" >
                            <Div data - role="header"   >
                                                              <H1 >The campus offering </h1 >
                                                              <A href="http://www.script-home.com//article/#pageone" data - rolr=button data - icon="home" class="UI - BTN - left >" The homepage </a>
                              </div>
                              <Div data - role="content" >
                              <The form action="upload_file. PHP" method="post" enctype="multipart/form - data" data - ajax="false" >
                                                              <Input  Id="uploadimg" name="file"   Type="file"   Runat="server" method="post"
                                                                                            Enctype="multipart/form - the data" data - the inline="true"   Data - ajax="false"/>
                                                              <Center> <Button  Data - the inline="true"   >Upload </button> </center>
                              </form>
                              </div>
                              <Div data - role="footer" data - position="fixed" data - fullscreen="true" >
                                                              <H1 >Innovation experiment </h1 >
                              </div>
            </div>
</body>
</html>


code is as follows:


<The ? PHP
              If ($_FILES [" file "] [" error "] >0)
              {
                              Echo "Return Code:". $_FILES [" file "] [" error "]
              }
              The else
              {
                            Echo "Upload:". $_FILES [" file "] [" name "]
                              Echo "Type:". $_FILES [" file "] [" Type "]
                            Echo "Size:". ($_FILES [" file "] [" Size "]/1024). "Kb
                              Echo "Temp file:". $_FILES [" file "] [" tmp_name "]
                              If (file_exists (" upload/". $_FILES [" file "] [" name ")))
                              {
                                              Echo $_FILES [" file "] [" name "] "already exists.";
                              }
                              The else
                              {
                                              Move_uploaded_file ($_FILES [" file "] [" tmp_name "],
                                            "Upload/". $_FILES/" file"/" name ");
                                              Echo "Stored in:"   . "the upload/". $_FILES [" file"] [" name ");
                              }
              }
}
The ? >

code is very simple, but found a problem in use process, oneself try for a long time all can't upload
Asked the friend, found that the problem is the insufficient file permissions, limiting the web page to upload pictures to the folder. So the solution is dropped the folder permissions problem solving.


code is as follows:


$CD/var/WWW
$sudo chmod - R  777   The HTML

ok, now you can upload files to the server folder.

you might be interested in the article:


This concludes the body part