The website is for sale. Check here for more information.
This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.
Fails to upload.
#1
PHP Code:
if (!$mybb->input["action"])
{
    
// Form
    
$form = new Form("index.php?module=mytest-addimg&action=add""POST""mytest"1);

    
// Container
    
$form_container = new FormContainer("Add New Image");
    
$form_container->output_row("Upload Image:"''$form->generate_file_upload_box('upimg''', array('id' => 'upimg')), 'upimg');

    
// End Container
    
$form_container->end();

    
// Buttons
    
$buttons = array();
    
$buttons[] = $form->generate_submit_button("Upload");
    
$buttons[] = $form->generate_reset_button("Reset");
    
$form->output_submit_wrapper($buttons);
    
$form->end();
}
else if (
$mybb->input["action"] == "add")
{
    
// Variables
    
$f_Directory MYBB_ROOT."/imgfolder/";
    
$f_Target $f_Directory.basename($_FILES["upimg"]["name"]);
    
$f_Extension pathinfo(f_TargetPATHINFO_EXTENSION);
    
    
// Check Extension
    
if($f_Extension != "jpg")
    {
        
// Message
        
flash_message("Invalid file selected, only JPG files accepted."'error');
        
admin_redirect('index.php?module=mytest-addimg');
    }
    else
    {
        if(
move_uploaded_file($_FILES["upimg"]["tmp_name"], $f_Target))
            
flash_message("File uploaded!"'success');
        else
            
flash_message("Failed uploading!"'error');

        
admin_redirect('index.php?module=mytest-addimg');
    }


So basically nothing gets uploaded.
Any idea guyes?
Reply
#2
I'm not sure if I'm understanding properly. Is this help with you need with a feature in MyBB or some code help you need? If it's the latter, I'll move this to Coding Help, rather than Support.
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.
Reply
#3
Yes I know its the wrong section.

But do u see whats wrong with the code?

Thanks
Reply
#4
By looking at it only, no. Did you debug it at least? To see where it's failing?
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.
Reply
#5
Fixed it.
Reply





Users browsing this thread: 1 Guest(s)

About MyBB-Plugins

Plug Yourself into the best MyBB AddOn.

Copyright © 2009-2021 MyBB-Plugins Forums.

Statistics

  • 51,000+ Posts
  • 19,000+ Members
  • 3,600+ Threads

Impressed? For sure
Check Full Stats here