Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Rockstaru

    (@rockstaru)

    Not an ideal one, but it fixes the problem. In the file.php file (should be under the types folder in the form-manager plugin folder), there is a function that reads as follows:

    protected function getFormattedFileName($uniqueName, $itemInfo){
    $pathInfo = pathinfo($_FILES[$uniqueName][‘name’]);
    $fileNameFormat = trim($itemInfo[‘extra’][‘name_format’]) == “” ? get_option( ‘fm-file-name-format’ ) : trim($itemInfo[‘extra’][‘name_format’]);
    if($fileNameFormat == “%filename%”){
    $newFileName = $pathInfo[‘filename’];
    }
    else{
    $fileNamePos = strpos($fileNameFormat, ‘%filename%’);
    if($fileNamePos !== false){
    if($fileNamePos > 0){
    $before = substr($fileNameFormat, 0, $fileNamePos);
    $after = substr($fileNameFormat, $fileNamePos + 10, strlen($fileNameFormat) – $fileNamePos – 10);
    }
    else{
    $before = “”;
    $after = substr($fileNameFormat, -1 * (strlen($fileNameFormat) – 10));
    }
    }
    $newFileName = “”;
    if($before != “”)
    $newFileName.= fm_get_time($before);
    if($fileNamePos !== false)
    $newFileName.= $pathInfo[‘filename’];
    if($after != “”)
    $newFileName.= fm_get_time($after);
    }
    $newFileName.= ‘.’.$pathInfo[‘extension’];

    return $newFileName;
    }

    Add the following before the final “return $newFileName;”

    $newFileName = preg_replace(“/[^A-Za-z0-9_-\s.]/”, “”, $newFileName);

    This essentially deletes all non-alphanumeric characters and spaces from the file name (and preserves periods, so the filetype is preserved). In the above example, “Dio, che nell’alma infondere.mp3” becomes “Dio che nellalma infondere.mp3.” Again, not an ideal solution, but it works.

    Thread Starter Rockstaru

    (@rockstaru)

    Thank you so much! This is perfect.

    Thread Starter Rockstaru

    (@rockstaru)

    If you wouldn’t mind doing that, I would really appreciate it. Thank you for all your hard work!

    Thread Starter Rockstaru

    (@rockstaru)

    One other question–with the multi-upload form, would it be possible to not start the upload until the user actually selects all of their files and clicks “Start Upload”? I’m trying to stupid-proof this as much as possible.

    Thread Starter Rockstaru

    (@rockstaru)

    That makes sense. I’ve been a little neurotic about this whole process as I’ve been having no end of trouble with some other plugins–glad I finally found something that works. Thanks so much!

    Thread Starter Rockstaru

    (@rockstaru)

    I was actually in the process of making some changes to the font, so it probably looked strange for a second. It appears it just takes longer to redirect when the upload size is larger.

Viewing 6 replies - 1 through 6 (of 6 total)