0
How to upload image from other server to another?
I would like to add an upload of files to my server where I will be uploading my files from other server within the same network. But I dont know what is the right code for PHP.
1 Resposta
0
you can use the $_FILES[] superglobal in combination with the move_uploaded_file() function. But beware, do not use this on public servers as it will probably be insecure if you're not an experienced developer. When not properly secured, it allows people to upload arbitrary (php) files to your server and execute them. In the worst case taking over your complete server and database.
If you want to do it securely you must manually write the file name/extension and not trust the user input, besides the file itself. Always use a whitelist of allowed extensions. (Do not trust MIME types)
If you want to upload it from a php file to another server, you can use the php cURL library to POST to the other server. I hope this information helps.