How can i upload image to a php server using MATLAB programmatically ?

2 ビュー (過去 30 日間)
Elias Hossain
Elias Hossain 2017 年 5 月 25 日
コメント済み: Elias Hossain 2017 年 5 月 25 日
%%%% Here is the MATLAB code
data = imread('loading.jpg');
%imshow(data);
url = 'https://teamextreme.000webhostapp.com/AndroidFileUpload/fileUpload.php';
webwrite(url,data);
///// Here is fileUpload.php
<?php
echo
$_FILES['image']['name'] .
'<br/>';
$target_path = "uploads/";
$target_path = $target_path . basename($_FILES['image']['name']);
try {
//throw exception if can't move the file
if (!move_uploaded_file($_FILES['image']['tmp_name'], $target_path))
{
throw new Exception('Could not move file');
}
echo "The file " . basename($_FILES['image']['name']) . " has been uploaded";
} catch (Exception $e) {
die('File did not upload: ' . $e->getMessage()); }
rename($target_path,"uploads/test.jpg");
?>
  1 件のコメント
Elias Hossain
Elias Hossain 2017 年 5 月 25 日
I don't know why is it not working.The error is: Error using webwrite (line 126) The media type 'application/x-www-form-urlencoded' is not permissible for numeric or logical data.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by