IOS app side upload image to web,php how to receive?
Before receiving, you need to make a decision to control whether the file is given upload.
Size control by uploading files
$_FILES["file"]["size"]
By whether or not you have defined the judgment
isset($_POST['file'])
Determine if there is a value
empty(file_get_contents("php://input")
However, there is a big problem, if you have set a judgment, you will not be able to upload.
If you do not add conditions directly to the upload, the file will be uploaded successfully.
move_uploaded_file($_FILES["file"]["tmp_name"], "./img/" . $_FILES["file"]["name"]);
So how do I receive a file sent over by ASI?
Does he exist with a key value?
Is the Forkey in the following statement a key?
[request setPostValue:@"" forKey:@"file"];
Reply content:
IOS app side upload image to web,php how to receive?
Before receiving, you need to make a decision to control whether the file is given upload.
Size control by uploading files
$_FILES["file"]["size"]
By whether or not you have defined the judgment
isset($_POST['file'])
Determine if there is a value
empty(file_get_contents("php://input")
However, there is a big problem, if you have set a judgment, you will not be able to upload.
If you do not add conditions directly to the upload, the file will be uploaded successfully.
move_uploaded_file($_FILES["file"]["tmp_name"], "./img/" . $_FILES["file"]["name"]);
So how do I receive a file sent over by ASI?
Does he exist with a key value?
Is the Forkey in the following statement a key?
[request setPostValue:@"" forKey:@"file"];
PHP program is done after the file upload is completed, that is, you can not use the PHP program to judge and prevent the file upload, because the program is running when the file has been uploaded to the server.
Your need only is to let the client first to upload the basic information of the file to another PHP program, the program through the information to determine whether the file is allowed to upload, and then upload pictures through this address.