I am new to php but i like to mess around with code.
What i am trying to do is...
scan a directory with image and once i got them send them to the upload_media function of my CMS. But the problem is that my upload_media function doesnt accept the array or anything. it performs the upload from the submited form on the frontend( $_FILES[ ][ ] ). Since i am working on the backend and trying to send images from the webserver i am having hard time figuring out how to send the post upload request so that my upload_media function can perform the upload.
Can anyone of the php guru's here help me out. Thanks
its social engine 3.15 and i am working with the groups plugin for social engine. i am trying to populate groups. which works fine...but i dont wanna add images to it 1 by 1....they way groups are created is based on the directory structure and then in each directory there are images. i wanna send those images to group_media_upload function in class_groups.php But that functions uses $_FILES array and doesnt accept any file. How can i pass data to $_Files? is it possible to pass data to global array $_Files ??
The upload page for the users who are asked to upload files uses form post. just like any other upload form. But since i am trying to do that from the php server side i am looking for a way to correctly populate the $_FILES array with the data that i wanna send to the upload function of the CMS because that function uses $_FILES array inorder to process the uploaded files.
If the $_FILES values you set are being passed to the upload script - you should continue with your current approach. Be sure to populate all the fields used.
I think you're going to need a custom function or an import process - the $_FILES array is populated by the server. An option you may want to consider is cURL.
I understand that i must populate all the fields. I dont understand what will be pushed in $_FILES[$file]['tmp_name']; ??? i cant keep that empty rite?
Try putting the name of the file as it exists on the server in 'tmp_name'.
This approach (using $_FILES) may work, but I think it's a gamble. If you only need the application to run on the server you're working on, you'll probably be fine, however, if you are planning to distribute the code or use a different server, you may want to find a different method.