MyBB-Plugins Forums
Fails to upload. - Printable Version

+- MyBB-Plugins Forums (
+-- Forum: MyBB General Discussion (
+--- Forum: Coding Help (
+--- Thread: Fails to upload. (/Thread-Fails-to-upload)

Fails to upload. - Ayoub - 05-08-2016

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

// Buttons
$buttons = array();
$buttons[] = $form->generate_submit_button("Upload");
$buttons[] = $form->generate_reset_button("Reset");
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');
move_uploaded_file($_FILES["upimg"]["tmp_name"], $f_Target))
flash_message("File uploaded!"'success');
flash_message("Failed uploading!"'error');


So basically nothing gets uploaded.
Any idea guyes?

RE: Fails to upload. - Diogo Parrinha - 05-08-2016

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.

RE: Fails to upload. - Ayoub - 05-09-2016

Yes I know its the wrong section.

But do u see whats wrong with the code?


RE: Fails to upload. - Diogo Parrinha - 05-10-2016

By looking at it only, no. Did you debug it at least? To see where it's failing?

RE: Fails to upload. - Ayoub - 05-10-2016

Fixed it.