[GH-ISSUE #760] Upload from URL error #520

Open
opened 2026-03-02 15:59:25 +03:00 by kerem · 5 comments
Owner

Originally created by @crispa on GitHub (Mar 26, 2022).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/760

Hi everyone,
I love Tinyfilamager, Thank you!
I have a problem after upload image from URL:

  • Preview thumbnail doesn't work
  • Direct Link doesn't work, I get Forbidden error
    But image file exists in my storage...
    Upload from URL was set to permission 0600 and upload image from file is set 0644, it's a problem about permissions?
Originally created by @crispa on GitHub (Mar 26, 2022). Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/760 Hi everyone, I love Tinyfilamager, Thank you! I have a problem after upload image from URL: - Preview thumbnail doesn't work - Direct Link doesn't work, I get Forbidden error But image file exists in my storage... Upload from URL was set to permission 0600 and upload image from file is set 0644, it's a problem about permissions?
Author
Owner

@prasathmani commented on GitHub (Mar 28, 2022):

mostly this will issue occur when you change the $root_path configuration, please make sure you change $root_url as well.

<!-- gh-comment-id:1080195263 --> @prasathmani commented on GitHub (Mar 28, 2022): mostly this will issue occur when you change the `$root_path` configuration, please make sure you change `$root_url` as well.
Author
Owner

@crispa commented on GitHub (Mar 28, 2022):

Thank you for your reply.
I tried many options but don't work.
Only when upload from URL persmissions was seted 0600...

<!-- gh-comment-id:1080423782 --> @crispa commented on GitHub (Mar 28, 2022): Thank you for your reply. I tried many options but don't work. Only when upload from URL persmissions was seted 0600...
Author
Owner

@crispa commented on GitHub (Apr 4, 2022):

No any update about this problem??

<!-- gh-comment-id:1088024059 --> @crispa commented on GitHub (Apr 4, 2022): No any update about this problem??
Author
Owner

@informas commented on GitHub (Jun 28, 2023):

I have the same problem.
I saw that when we "Upload from URL" the file permissions are set to "600" and TFM require "0604" to show the file or enable access,

<!-- gh-comment-id:1611677785 --> @informas commented on GitHub (Jun 28, 2023): I have the same problem. I saw that when we "Upload from URL" the file permissions are set to "600" and TFM require "0604" to show the file or enable access,
Author
Owner

@RavanH commented on GitHub (Feb 6, 2024):

Hi all, it is because Tiny File Manager uses tempnam() to create the temporary file. This function creates a file with 600 permissions by default.

This can be fixed by adding a chmod to the success block that starts on line 650 so it looks like this:

if ($success) {
    chmod($temp_file, 0644);
    $success = rename($temp_file, strtok(get_file_path(), '?'));
}
<!-- gh-comment-id:1929870046 --> @RavanH commented on GitHub (Feb 6, 2024): Hi all, it is because Tiny File Manager uses [tempnam()](https://www.php.net/manual/en/function.tempnam.php) to create the temporary file. This function creates a file with 600 permissions by default. This can be fixed by adding a `chmod` to the success block that starts on line 650 so it looks like this: ``` if ($success) { chmod($temp_file, 0644); $success = rename($temp_file, strtok(get_file_path(), '?')); } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tinyfilemanager#520
No description provided.