HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

File failed to upload

Hey folks. I am new to Vanilla forum and I truly like it. However there is one thing that I am struggling with already second day today.
I can't upload any attachment to a discussion.

Interesting enough I can't do it here on official forum either. It keeps saying: "File failed to upload."

I have checked permissions for the user, I have upload permissions on my forum. I have also checked php.ini and file upload is enabled (which is also proven by the fact that I was able to upload my profile picture). I don't know what else to try as I can't get any more specific message out of it.

Now when I saw that I can't upload the file in here, I was thinking the issue may have been on the client side, but I had my friend trying to upload an attachment and it hasn't been working for him either.

Any idea? It's driving me crazy.

Thanks a lot.

«1

Comments

  • RiverRiver MVP
    edited August 2016

    @zatokar said:
    Interesting enough I can't do it here on official forum either. It keeps saying: "File failed to upload."\

    if you can't upload an attachment here. It can be one of three+ reasons.

    without you providing specific information on size, type of attachment, etc, it is impossible to guess beyond that.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • @River said:

    @zatokar said:
    Interesting enough I can't do it here on official forum either. It keeps saying: "File failed to upload."\

    if you can't upload an attachment here. It can be one of three reasons.

    • the format type is not allowed
    • the file is too big
    • your connection is too slow and times out.

    without you providing specific information on size, type of attachment, etc, it is impossible to guess beyond that.

    Thank you for your reply.

    I have tried several file types: jpg, png, txt and several sizes, most of them below 2mb, one of them was only a favicon.png of a very small size. My internet connection is just fine and it doesn't time out.

    Can you please try to do the upload on my forum? http://maguss.org/forum

    Thanks again.

  • RiverRiver MVP
    edited August 2016

    @zatokar said:Interesting enough I can't do it here on official forum either. It keeps saying: "File failed to upload."

    you said you can't upload to this forum. so

    download this image to your computer

    change the name to testimage.png on your computer.
    and try to re-upload it to this forum vanillaforums.org and then use your web developer tools to determine if there was any error in request or other errors

    once again if you don't use exact specs. impossible to tell name size resolution.

    I suggest you study these, since you might be the only one able to troubleshoot.

    https://www.google.com/search?q=400+bad+request

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • This image works on this forum. I have now tried also different image and it worked well. But neither of these work on my forum still :(

  • RiverRiver MVP
    edited August 2016

    @zakotar: This image works on this forum.

    I can't see the image you tried on this forum. :) so I can't help.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • Huh. Weird.

    Could you confirm the caylus account on your forum? I didn't get the confirmation email and the Google+ signin also doesn't work.

    I'm able to upload files here, so I can try it on your forum too.

    What browser and OS are you using? Can you try Google Chrome if you're not using that already?

  • @Caylus said:
    Huh. Weird.

    Could you confirm the caylus account on your forum? I didn't get the confirmation email and the Google+ signin also doesn't work.

    I'm able to upload files here, so I can try it on your forum too.

    What browser and OS are you using? Can you try Google Chrome if you're not using that already?

    Thank you Caylus, really appreciate your help. I am having troubles with that email sending. For some reason AWS SMTP doesn't work. But will fix that ASAP then you can try to upload. Will ping you here.

    Btw if you would be willing to help me with this, we could connect on Skype and I could pay you for it. I mean I have limited time right now and I am unsure if I can fix all I need. My id: zatokar1

    vrijvlinder
  • So, if you try to upload something that's way to big on your forum, you get the appropriate error. It's clearly able to tell something about the uploaded file.

    But after that, $_FILES[$InputName]['error'] equals UPLOAD_ERR_NO_FILE. I have no idea what that means or what causes it (especially since it's clearly able to detect the file size, so you would expect the uploaded file to exist somewhere), except that I'd expect a UPLOAD_ERR_CANT_WRITE (judging from the name) if there was something wrong with your write permissions.

    Could you check max_upload_filesize, max_post_data_size, memory_limit, max_execution_time in your php.ini file?

    Which version of PHP are you using?

    Thanks for the offer of paying me by the way, but I'd recommend hiring an actual programmer for that if you're on a deadline.

    vrijvlinder
  • @Caylus said:
    So, if you try to upload something that's way to big on your forum, you get the appropriate error. It's clearly able to tell something about the uploaded file.

    But after that, $_FILES[$InputName]['error'] equals UPLOAD_ERR_NO_FILE. I have no idea what that means or what causes it (especially since it's clearly able to detect the file size, so you would expect the uploaded file to exist somewhere), except that I'd expect a UPLOAD_ERR_CANT_WRITE (judging from the name) if there was something wrong with your write permissions.

    Could you check max_upload_filesize, max_post_data_size, memory_limit, max_execution_time in your php.ini file?

    Which version of PHP are you using?

    Thanks for the offer of paying me by the way, but I'd recommend hiring an actual programmer for that if you're on a deadline.

    These are properties:
    upload_max_filesize = 2M
    post_max_size = 8M
    max_execution_time=300

    My php version is: 5.5.38 and vanilla version: 2.2.1

    I am not sure if I can find anyone within the time. I would need an assistance. Feel free to add me, we can discuss it there too. Thanks.

  • Forgot to mention, avatar image upload works just fine.

  • CaylusCaylus ✭✭
    edited September 2016

    Sorry, I made a mistake. It might be an UPLOAD_ERR_NO_FILE, it might also be an other error.

    Can you enable logging: https://vanillaforums.org/discussion/26786/tutorial-how-to-enable-a-debug-log-and-collect-debugging-information

    And then add a few logging commands to [your root folder]\library\core\class.upload.php ?:

        public function validateUpload($InputName, $ThrowException = true) {
            $Ex = false;
    //Add the following line:
            LogMessage(__FILE__,__LINE__,serialize($_FILES));
    

    And (later on in the same function)


    And report the output of log/debuglog to here?
    That might shine some light on what exactly is going wrong.

  • @Caylus said:
    Sorry, I made a mistake. It might be an UPLOAD_ERR_NO_FILE, it might also be an other error.

    Can you enable logging: https://vanillaforums.org/discussion/26786/tutorial-how-to-enable-a-debug-log-and-collect-debugging-information

    And then add a few logging commands to [your root folder]\library\core\class.upload.php ?:

        public function validateUpload($InputName, $ThrowException = true) {
            $Ex = false;
    //Add the following line:
            LogMessage(__FILE__,__LINE__,serialize($_FILES));
    

    And (later on in the same function)


    And report the output of log/debuglog to here?
    That might shine some light on what exactly is going wrong.

    Thank you for your guidance, here is the output (not sure how to put it to a block of code):

    01 Sep 2016 - 14:12:50: [Garden] C:\Users\Administrator\Desktop\LandingPage\forum\library\core\class.upload.php, 361, a:1:{s:12:"editorupload";a:5:{s:4:"name";s:37:"feelin classy London Lenka Ondrej.jpg";s:4:"type";s:10:"image/jpeg";s:8:"tmp_name";s:27:"C:\Windows\Temp\phpE462.tmp";s:5:"error";i:0;s:4:"size";i:28968;}}.()
    01 Sep 2016 - 14:12:50 maguss.org Garden Exception: in C:\Users\Administrator\Desktop\LandingPage\forum\library\database\class.database.php on 42201 Sep 2016 - 14:12:50 maguss.org Garden #0 [internal function]: Gdn_ErrorHandler(256, '', 'C:\Users\Admini...', 422, Array)01 Sep 2016 - 14:12:50 maguss.org Garden #1 C:\Users\Administrator\Desktop\LandingPage\forum\library\database\class.database.php(422): trigger_error('', 256)01 Sep 2016 - 14:12:50 maguss.org Garden #2 C:\Users\Administrator\Desktop\LandingPage\forum\library\database\class.sqldriver.php(1663): Gdn_Database->query('insert GDN_Medi...', Array, Array)01 Sep 2016 - 14:12:50 maguss.org Garden #3 C:\Users\Administrator\Desktop\LandingPage\forum\library\database\class.sqldriver.php(1083): Gdn_SQLDriver->query('insert GDN_Medi...', 'insert')01 Sep 2016 - 14:12:50 maguss.org Garden #4 C:\Users\Administrator\Desktop\LandingPage\forum\library\core\class.model.php(272): Gdn_SQLDriver->insert('Media', Array)01 Sep 2016 - 14:12:50 maguss.org Garden #5 C:\Users\Administrator\Desktop\LandingPage\forum\library\core\class.model.php(205): Gdn_Model->insert(Array)01 Sep 2016 - 14:12:50 maguss.org Garden #6 C:\Users\Administrator\Desktop\LandingPage\forum\plugins\editor\class.editor.plugin.php(823): Gdn_Model->save(Array)01 Sep 2016 - 14:12:50 maguss.org Garden #7 [internal function]: EditorPlugin->postController_editorUpload_create(Object(PostController), Array)01 Sep 2016 - 14:12:50 maguss.org Garden #8 C:\Users\Administrator\Desktop\LandingPage\forum\library\core\class.dispatcher.php(316): call_user_func_array(Array, Array)01 Sep 2016 - 14:12:50 maguss.org Garden #9 C:\Users\Administrator\Desktop\LandingPage\forum\index.php(44): Gdn_Dispatcher->dispatch()01 Sep 2016 - 14:12:50 maguss.org Garden #10 {main}

  • CaylusCaylus ✭✭
    edited September 2016

    K, you can remove the two LogMessage lines ( LogMessage(FILE,LINE,serialize($_FILES)); and the other), there's no issue with that part of the code. I would keep logging on for now though, might be handy.

    You create code blocks by starting and ending them with three ~'s by the way!

    Like this:
    ~~
    Code
    ~~

    Can you check in your database if there's a table gdn_media present?

    And can you disable and then reenable the advanced editor plugin? (That'll hopefully cause it to create all the tables it needs).

  • @Caylus said:
    K, you can remove the two LogMessage lines ( LogMessage(FILE,LINE,serialize($_FILES)); and the other), there's no issue with that part of the code. I would keep logging on for now though, might be handy.

    You create code blocks by starting and ending them with three ~'s by the way!

    Like this:
    ~~
    Code
    ~~

    Can you check in your database if there's a table gdn_media present?

    And can you disable and then reenable the advanced editor plugin? (That'll hopefully cause it to create all the tables it needs).

    There is table gdn_media and it contains only entries from changing a profile picture. I have reenabled the advanced editor plugin soo many times already. Didn't help :(.

  • Sorry man. I'm at a loss. I'd personally back everything up, delete everything (also the database), start over with the most basic theme and no plugins, try to see if you can upload files, if yes, start changing the theme and add plugins until it doesn't work anymore.

    Or, simply disable the advanced editor for now while you launch.

    You can then try using a local version of Vanilla with XAMPP for example to see if you get the uploads working there, add your theme to see if it crashes the upload etc.etc.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited September 2016

    I see some issues might be related , you need to use pretty Urls. You must make sure that your htaccess file is correct, and the you have enabled rewrite module.

    Some plugins require this and in the future it will be required in the next version of vanilla. Most issues are caused by failure to set these things up properly.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
  • @Caylus said:
    Sorry man. I'm at a loss. I'd personally back everything up, delete everything (also the database), start over with the most basic theme and no plugins, try to see if you can upload files, if yes, start changing the theme and add plugins until it doesn't work anymore.

    Or, simply disable the advanced editor for now while you launch.

    You can then try using a local version of Vanilla with XAMPP for example to see if you get the uploads working there, add your theme to see if it crashes the upload etc.etc.

    Shame. Thank you for your help anyway.

    btw in the log I can see something about database etc, isn't that the problem?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @zatokar

    This might help, if you don't choose to ignore it … download and extract the file I attached and upload it to your forum folder , the link to see the settings of the PHP and all the other things like memory etc

    yourforum.com/phpinfo.php

    and there you can see what the settings are and you can ask your host to modify them if need be, below are the values I have in my phpinfo page for my setup. It seems your values are incorrect for a couple of these.

    file_uploads ON

    upload_max_filesize 20M

    post_max_size 20M

    max_execution_time 120

    max_file_uploads 20

    memory_limit 128M

  • @vrijvlinder said:
    @zatokar

    This might help, if you don't choose to ignore it … download and extract the file I attached and upload it to your forum folder , the link to see the settings of the PHP and all the other things like memory etc

    yourforum.com/phpinfo.php

    and there you can see what the settings are and you can ask your host to modify them if need be, below are the values I have in my phpinfo page for my setup. It seems your values are incorrect for a couple of these.

    file_uploads ON

    upload_max_filesize 20M

    post_max_size 20M

    max_execution_time 120

    max_file_uploads 20

    memory_limit 128M

    Thanks a lot for popping in with your ideas. I have uploaded the file there, it all seems correct in my setup. Also take into account that avatar picture can be loaded just fine. Any other ideas? Can it be related to DB or versions of something?

Sign In or Register to comment.