php - Can I use file_put_contents() to populate $_FILES? -


the goal:

i have url of image. image file , upload $_files if image uploaded client.

the reason:

i need because have form in users can either upload image file in input type="file" field or enter image url in input type="text" field , later, when validate form, want validation function access file using $_files regardless method user chose supply image (either uploading file or entering file url.)

the problem:

i found this answer on using file_put_contents() , file_get_contents() don't understand if can use change $_files , if yes how.

edit:

after reading david's comment, understood mistake. need way download file url using file_get_contents() , file_put_contents() same temporary location on server uploaded files downloaded to. able handle files same way regardless of how got there (url or file upload).


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -