We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Not sending to $_FILES?

Development and Programming

SDuke's avatar
SDuke
11 posts
14 years ago
SDuke's avatar SDuke

In my module, I’m trying to send a picture to $_FILES then retrieve it and put it in a specific folder. However, when I try it shows up that $_FILES is empty. I tried using print_r and echo count() but they just returned empty arrays and 0. This code is the code for the cp backend page. help?

<?php
    if (isset($_POST['xsubmit']))
    {
        echo count($_FILES);
        echo count($_FILES['upload']);
        print_r($_FILES);
        print_r($_FILES['upload']);
        $image=$_FILES['upload']['name'];
        $folder='';
        if ($image)
        {
            $filename=$folder . $image;
            copy($_FILES['upload']['tmp_name'],$filename);
        }
    }
?>

<?= form_open('C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=picture_uploader')//sets homepage and opens form?>
    
    <span>Upload</span> your pictures here.
    <?= form_upload(array('name'=>'upload','enctype'=>'multipart/form-data','class'=>'file','value'=>'Choose picture'))//file select button?> 
    
    
        <?= form_submit(array('name' => 'xsubmit', 'value' => 'Upload', 'class' => 'submit'))//creates submit button?>
        <?= form_close()//closes form?>
    
       
SDuke's avatar
SDuke
11 posts
14 years ago
SDuke's avatar SDuke

fixed it

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.