GC0202 /
ThinkLibrary
| 1 | <?php |
||||||
| 2 | //更加详细的表单上传请参考js sdk |
||||||
| 3 | require_once "../Ks3Client.class.php"; |
||||||
| 4 | |||||||
| 5 | $client = new Ks3Client("",""); |
||||||
| 6 | $bucket_name = "phpsdktestlijunwei"; |
||||||
| 7 | if(!$client->bucketExists(array("Bucket"=>$bucket_name))){ |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 8 | $client->createBucket(array("Bucket"=>$bucket_name)); |
||||||
|
0 ignored issues
–
show
The method
createBucket() does not exist on Ks3Client. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 9 | } |
||||||
| 10 | |||||||
| 11 | |||||||
| 12 | $key = 'formuploadtest/@中文.txt'; |
||||||
| 13 | $host = "kss.ksyun.com"; |
||||||
| 14 | $host_uri = "http://".$host."/".$bucket_name; |
||||||
| 15 | $redirect = $host_uri; |
||||||
| 16 | |||||||
| 17 | //将所有能确定值的表单项都放在该数组中 |
||||||
| 18 | $postData = array( |
||||||
| 19 | "key"=>$key, |
||||||
| 20 | "success_action_redirect"=>$redirect, |
||||||
| 21 | "Content-Type"=>"text/html", |
||||||
| 22 | ); |
||||||
| 23 | //将不能确定值的表单项都放在该数组中 |
||||||
| 24 | $unknowData = array( |
||||||
| 25 | "random" |
||||||
| 26 | ); |
||||||
| 27 | $result = $client->postObject($bucket_name,$postData,$unknowData); |
||||||
| 28 | print_r($result); |
||||||
| 29 | |||||||
| 30 | ?> |
||||||
| 31 | <html> |
||||||
| 32 | <head> |
||||||
| 33 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
||||||
| 34 | </head> |
||||||
| 35 | <body> |
||||||
| 36 | <form action="<?php echo $host_uri;?>" method="post" enctype="multipart/form-data"> |
||||||
| 37 | Key to upload: <input type="input" name="key" value="<?php echo $key;?>" /><br /> |
||||||
| 38 | <input type="hidden" name="success_action_redirect" value="<?php echo $redirect;?>" /> |
||||||
| 39 | <input type="hidden" name="Content-Type" value="text/html" /> |
||||||
| 40 | <input type="hidden" name="random" value="vfegf34egf3" /> |
||||||
| 41 | <input type="hidden" name="KSSAccessKeyId" value="<?php echo $result["KSSAccessKeyId"];?>" /> |
||||||
| 42 | <input type="hidden" name="Policy" value="<?php echo $result["Policy"];?>" /> |
||||||
| 43 | <input type="hidden" name="Signature" value="<?php echo $result["Signature"];?>" /> |
||||||
| 44 | File: <input type="file" name="file" /> <br /> |
||||||
| 45 | <!-- The elements after this will be ignored --> |
||||||
| 46 | <input type="submit" name="submit" value="Upload to KSS S3" /> |
||||||
| 47 | </form> |
||||||
| 48 | </html> |