Php move upload file with ftp_put -
move_uploaded_file(); ftp_put();
i have input type file, let user upload image.
i try save user's image different server or sub domain.
so if uploads malicious file server wont execute on main server.
my questions are
how can use
move_uploaded_file
ftp_put
?should server or sub domain enough?
using different subdomain not isolate server: need put on different machine. however, saving file server not put in danger. problem comes when tries interact file in unsafe way. instance, particular image viewing program may have flaw in malicious image take advantage of. in case, opening uploaded image program put @ risk.
checking file extension not legitimate way determine file type. instance, write malicious executable file , name my_vacation_pic.jpeg
. once again, not problem save on filesystem.
if want figure out file type, want unix file
command, though i'm not sure of kind of risks involved in opening possibly malicious files command.
however, file
not guarantee there nothing malicious in file. instance, may tell it's executable program of variety, can't tell it's safe run. or can tell it's jpeg file, can't tell hasn't figured out way make malicious if opened in particular program. best way sure file has nothing malicious in use genuine anti-virus software (and course, there no guarantees there either).
but really, need security depends entirely on intend it. storing data not mean executed in anyway (unless there specific vulnerability os, file-system driver, or program putting file there).
to direct question:
the file upload puts uploaded content on filesystem: can use normal means have of moving file 1 system another. instance, yes, can use ftp_put
transfer file local filesystem remote ftp server, other file. variable $_files["upload_key"]["tmp_name"]
tells filesystem path uploaded file stored, should able pass directly ftp_put
other file.
Comments
Post a Comment