Jump to content

[SOLVED] pass $_FILES array to function


alemapo

Recommended Posts

Hi,

I am creating an external function to do upload and move of images on my web pages so that I can call the same function from multiple screens.  I need to pass the $_FILES array to the function but can not figure out the syntax. I have tried everything I can think of and get syntax errors.  My function name is upload_image and I need to pass the entire $_FILES array to the function so that all the error checking and actual move can be done in the function.  I need help with the function declaration line with the array and the call to the function line for the array.  I have tried everything I can think of.

 

For the declaration I have tried:

 

function upload_image takes_array($_FILES)  {

 

(or)

 

function upload_image($_FILES) {

 

 

For the call to the function I have tried:

upload_image($_FILES['upload']['type']);

 

(Or)

upload_image($_FILES);

 

No variation I try works. I know you can send an array to the function but do I need to do something different since this is $_FILES?  Any help would be greatly appreciated.

 

Thanks!

Pamela

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/170949-solved-pass-_files-array-to-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.