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

File Upload Fail

edited July 2012 in Vanilla 2.0 - 2.8

Hey I have this plugin installed in my forum and it was working fine then this started happening, I have uninstalled it and re installed it and the same thing happens

Comments

  • peregrineperegrine MVP
    edited July 2012
    check and see if the path where your are saving files has 777 permissions.
    
    check the $SavePath variable around 725 in class.fileupload.plugin.php
    
     $SavePath = MediaModel::PathUploads().$SaveFilename;
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • 422422 Developer MVP

    Could be theres a space in the filename

    There was an error rendering this rich post.

  • Never had that problem before, just tried it without spaces and yeah still giving me the same message.

  • peregrine said:
    check and see if the path where your are saving files has 777 permissions.

    check the $SavePath variable around 725 in class.fileupload.plugin.php

    $SavePath = MediaModel::PathUploads().$SaveFilename;

    Ill check that out now

  • edited July 2012

    This is what I have

         if (!$Handled) {
            // Build save location
            $SavePath = MediaModel::PathUploads().$SaveFilename;
            if (!is_dir(dirname($SavePath)))
               @mkdir(dirname($SavePath), 0777, TRUE);
            if (!is_dir(dirname($SavePath)))
               throw new FileUploadPluginUploadErrorException("Internal error, could not save the file.", 9, $FileName);
    
            // Move to permanent location
            $MoveSuccess = @move_uploaded_file($FileTemp, $SavePath);
            if (!$MoveSuccess)
               throw new FileUploadPluginUploadErrorException("Internal error, could not move the file.", 9, $FileName);            
    
  • peregrineperegrine MVP
    edited July 2012

    peregrine said: check and see if the path where your are saving files has 777 permissions. >

    So you can't upload any files at all or just a specific one?

    Can it make the directory is the big question.
    Just because the command is there doesn't mean it can do it successfully.

    If not manually create it. If that is the issue. You won't know until you verify where it is trying to write the file and if it has permission to do so.

       if (!$Handled) {
        // Build save location
        $SavePath = MediaModel::PathUploads().$SaveFilename;
        if (!is_dir(dirname($SavePath)))
        @mkdir(dirname($SavePath), 0777, TRUE);
    
        // try this to get some more info.
        var_dump($SavePath);
    
      if (!is_dir(dirname($SavePath)))
        throw new FileUploadPluginUploadErrorException("Internal error, could not save the file.", 9, $FileName);
        // Move to permanent location
        $MoveSuccess = @move_uploaded_file($FileTemp, $SavePath);
        if (!$MoveSuccess)
        throw new FileUploadPluginUploadErrorException("Internal error, could not move the file.", 9, $FileName); 
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited July 2012

    to better identify problem

    change this temporarily from

    if (!is_dir(dirname($SavePath)))
                   throw new FileUploadPluginUploadErrorException("Internal error, could not save the file.", 9, $FileName);
    

    to

      if (!is_dir(dirname($SavePath)))
                   throw new FileUploadPluginUploadErrorException("Internal error, could not save the file in $SavePath  .", 9, $FileName);
    

    then you will probably see that you need to change permissions and/or ownership in the /vanilla/uploads directory.

    the group ownership should be the web owner.

    the permissions for the group needs to be writeable.

    so if the error is

    File upload failed. Reason:
    
        (test.png) Internal error, could not save the file in /var/www/vanilla/uploads/FileUpload/fe/0648a00de6072d5d94b37e737dc02a.png.
    
    
    the problem is with uploads.
    
    the directory preceding FileUpload in the path must allow directory creation (through the privileges above).
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Yeah I looks like it was a permissions thing, Thanks for that peregrine, looks like its working now.

  • also what 422 said about spaces in filenames can get you in trouble. I would avoid them at all costs. Use underscore or dash.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.