我想发送一个HTTP发布请求,到目前为止一切都很好(我在此应用程序中发送了10个以上的请求),但是现在出现了问题。
我收到此错误:
start()
这是接口代码:
is_uploaded_file
这是我的MainActivity代码:
<?php
...
if (is_post_request()) {
// Do your normal `category` processing
$args = $_POST['category'];
$category->merge_attributes($args);
// Only process the file if the user uploaded it.
if (is_uploaded_file($_FILES['cat_image']['tmp_name'])) {
$category->set_file($_FILES['cat_image']);
$result = $category->save_photo();
}
...
}
此行有错误:
<?php
...
if (is_post_request()) {
// Do your normal `category` processing
$args = $_POST['category'];
$category->merge_attributes($args);
// Only process the file if the user uploaded it.
if (is_uploaded_file($_FILES['cat_image']['tmp_name'])) {
// Check if image already exists.
// I do not know anything about your tables so I am just making one up here.
// Please don't ask me to write this for you.
// This is just pseudo code.
$query = 'SELECT 1 FROM table WHERE id = ? AND image_url IS NOT NULL';
if ($query->result == 1) {
// The row already contains a value - do something. Or not...
}
$category->set_file($_FILES['cat_image']);
$result = $category->save_photo();
}
...
}
答案 0 :(得分:2)
您尚未注释第二个参数。...可以是@ Body,@ Query等。...添加注释
答案 1 :(得分:0)
将界面方法更改为此
@FormUrlEncoded
@POST("index.php/web/request")
Call<MyResponse> getMy(@Header("authorization") String token);
或
@FormUrlEncoded
@POST("index.php/web/request")
Call<MyResponse> getMy(@Header("authorization") String token, MyRequest myRequest);