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

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -