Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

File Upload Fail

edited July 2012 in Questions
This discussion is related to the FileUpload addon.

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;
    

    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

    UnderDog
  • 422422 Developer MVP

    Could be theres a space in the filename

    422 Real Estate Australia , now open Check it out

    UnderDog
  • 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); 
    

    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

    UnderDog
  • 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).
    

    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

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

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


    factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!

    Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant

    UnderDog
Sign In or Register to comment.