PHP - 可以在没有<form>标签的情况下上传吗?

If upload file with php , with simple way , i can do like this page

<?php 
  if($_FILES)
{
   DO UPLOAD 
}
?>
<form action='' enctype='multipart/form-data' method='post'>
  <input type="file" name="file">
  <input type="submit" name="upload" value="submit">
</form>

And now, i have to upload file but with out <form> tag like this

------index.html----
    <input type="file" name="file">
    <a href="upload.php">Upload</a>
--------------------

------upload.php-----
 CODE PHP TO UPLOAD FILE
---------------------

when click upload link , it can be a page that do upload.

But i don't know how to the upload page can get file without tag form

Simple index.html only to send file name , and where it local to upload page proccess

sorry for my bad english

It's not quite clear what you want. But there is in fact a way to upload files without forms (and its POST request method/ctype). It's called a "PUT" request. All major http libraries can do that. Major browsers only via AJAX.

However, the receiving script must have specific support for it. Needs to check $_SERVER[REQUEST_METHOD] and read form php://input, and it really just allowed receiving a single file. It might even be necessary to set it up as Apache handler:

First Google result: http://www.phpbuilder.com/manual/features.file-upload.put-method.php

No. Onlywith help o multipart/orm-data form you can send $_FILES array for upload.

No, it is not possible to do a standard file upload without a <form> tag.

The only exception would be a jQuery / Javascript workaround.

It seems like what you want is a submit button that looks like a link. You probably want something like (HTML):

<form action="upload.php" type="multipart/form-data">
    <input type="file" name="file" />
    <button type="submit" class=="upload-submit">Upload</button>
</form>

And (CSS):

button.upload-submit {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    color: #00f; /* Your link color here */
    background-color: transparent;
    text-decoration: underline;
}