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.
How can i upload image to a php server using MATLAB programmatically ?
2 ビュー (過去 30 日間)
古いコメントを表示
%%%% 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");
?>
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Web Services についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!