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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.