I know that it is not recommended to hide warnings with @copy, but what other alternatives exist?
Is there a way to make sure the copy will work or not?
Use is_readable () and is_writable () to check the source and target status before trying to copy ().
Indeed, you should not display errors in the browser. Turn off display_errors in php.ini.
display_errors
You can then check to see if its logical return value succeeded without worrying about the warnings on the screen.
if (!copy('srcfile', 'destfile')) { // something failed. }
If you use the "@" in front of the function, you will not receive a warning or notification, but you will save the result (boolean, string ...).
Try the following:
if ( !@copy ('srcfile', 'destfile')) { // something failed. }
Source: https://habr.com/ru/post/1390867/More articles:jqGrid - pager not shown. How to enable it? - javascriptWhere to place the declaration of use - c ++Using linq to check if a condition exists - c #Why does cout prevent subsequent code from running? - c ++How to define span tag in dropdown list option - javascriptHow to remove the root element of my Jetty webapp url? - javaWIX installer - distinguishes 32 bits from 64 bits - wixLinq - getting consecutive numbers in an array - c #How to connect Firebird DB with Qt? - qtwhy boost :: scoped_ptr is cleared in a singleton implementation - c ++All Articles