i want to add images in $_Files directly from my code in php
i am writing code in php so that rather than 开发者_高级运维posting images from form i want to add images in $_files direct from my code
$_FILES
is just an array like any other, except that when the script starts, it's pre-populated with information regarding any file uploads.
This array is writable, and you can use it to store any information you like. So to add a new element to the array, just add it as you would any other.
Doing so will have no other side-effects however. You'll just have another element in the array. Nothing more.
As tylerl said, $_FILES
is an array like any other. Just have two things in mind:
- There is a difference how the $_FILES array looks for files that were submitted by a) inputs with different names and b) inputs with "array" names like
file[]
. - The
is_uploaded_file()
andmove_uploaded_file()
function will not work!
精彩评论