0
我試圖獲取文件路徑,以便我可以在Windows azure blob容器中上傳。php:Windows Azure代碼的文件路徑
public function upload_container()
{
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
$this -> load -> helper('form');
$this -> load -> helper('url');
$result=$this-> input ->post('file');
$result1=$_FILES['file']['tmp_name'];
if($result != NULL)
{
$content = fopen($result1, "r");;
$blob_name = "myblob3.jpg";
try {
$blobRestProxy->createBlockBlob("mycontainer", $blob_name, $content);
$data['blob_error']="check Azure Container";
$this->load->view('blob',$data);
}
catch(ServiceException $e){
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code.": ".$error_message."<br />";
}
}else{
$this -> load -> helper('form');
$this-> load -> view('blob');
}
}
我看來
<?php
echo form_open('blob/upload_container');
?>
Select a file:
<input type="file" name="file" id="file">
<input type="submit" value="Upload Image" name="submit">
<?php if(isset($blob_error)){echo $blob_error;} ?>
</form>
錯誤: Error Page 這是我的代碼,我用笨。 $ _FILES返回數組(0){}當我使用var-dump和NULL在print_r。
如果我無法獲取文件路徑,我不能上傳文件。那麼我如何解決它?
你在哪裏打開你的
echo form_open('blob/upload_container'); - >表格標籤打開 –