So from my iOS device, I am planning on uploading a profile pic for the user to the php server. Most likely I will be using new AFNetworking for this. My question is, how big files should I allow on my php side? For security reasons (just to be safe) I don't want to allow absurdly big images. is there a limit which all ios pic sized under? what would happen if user selects a pic which he downloaded from internet or somewhere else and the size is bigger? Is there a way to ensure the file size is reduced (without compromising quality) to under certain size on the client side?
Second question I have - is uploading base64 encoded images smaller in size as compared to regular images?
Last question - on the ios device, is there a way to check the size of an image? I am sure there is some app for this. (without code)
My php backend looks like:
$target_dir = "/Users/username/foldername/"; $target_dir = $target_dir . basename( $_FILES["uploadFile"]["name"]); $uploadOk=1; if ($_FILES["uploadFile"]["size"] > 500000) { echo "Sorry, your file is too large.\n"; $uploadOk = 0; } if ($_FILES["uploadFile"]["type"] != "image/png") { echo "Sorry, only png files are allowed. Your file type was ". $uploadFile_type; $uploadOk = 0; } if ($uploadOk == 1){ if (move_uploaded_file($_FILES["uploadFile"]["tmp_name"], $target_dir)) { echo "The file ". basename( $_FILES["uploadFile"]["name"]). " has been uploaded.\n"; } else { echo "Sorry, there was an error uploading your file.\n"; } } else { echo "Sorry, there was an error uploading your file.\n"; }