Can i also use file_put_contents($fileapp,$content,FILE_BINARY); to move uploaded files?
+2
A:
You can. But why not use move_uploaded_file()
instead? This is generally considered to be safer than trying to access the path in $_FILES
, since move_uploaded_file()
does check if the file really is a file and if it was actually uploaded by the user.
If you can't use the move_uploaded_file()
, remember to call is_uploaded_file()
before you do the file_put_contents()
call. Just for your own safety.
naivists
2010-01-21 10:37:41
Because its a Class and i will use it somewhere else
streetparade
2010-01-21 10:39:02
Better to move the file first using the move_uploaded_file() before processing it with your class, so you make use of the safety checks of that function.
Veger
2010-01-21 10:42:28
WOW Thanks Very much have a nice Day
streetparade
2010-01-21 10:43:49