Cannot refer to uploaded files
Just done an install, tried to upload a file and refer it to a page 'file:/test/image_21.png'
but I got 404 file:/test/image_21.png error message.
This my env
PHP 7.4.29 (cli) (built: Apr 12 2022 10:55:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with the ionCube PHP Loader + ionCube24 v11.0.1, Copyright (c) 2002-2022, by ionCube Ltd.
with Zend OPcache v7.4.29, Copyright (c), by Zend Technologies
Server version: Apache/2.4.6 (CentOS) Server built: Mar 24 2022 14:57:57
Wackowiki version: 6.0.25
Server version: 8.0.19 MySQL Community Server - GPL
Any ideas?
thanks and regards
Comments
Log in or create an account to post a comment.
Re: Cannot refer to uploaded files
file:syntax is displayed in the filemeta handler. Normally, the relative path is sufficient. The absolute path is required only when you embed a local file attached to a page in another page.A
404 file:/test/image_21.pngmessage indicates that either/testpage.file:image_21.pngandfile:/image_21.png/test/attachments-> to page -> click on the image)Please check the
file/perpage/andfile/folder/folder as well thefiletable in the database, if the uploaded file is there.Do you use mod_rewrite?
Re: Cannot refer to uploaded files
1. the path to the file is false --> The path is correct and has the right permission.
file/perpage/@18@image_21.png2. the file upload failed --> Upload is succeded.
File upload successfulbut alsoFile not foundmessages3. the file folder has insufficient access rights --> 'file/perpage' and 'file/global' have permission (I have tried full 777 permission)
4. check the file/perpage/ and file/folder/ folder as well the file table in the database --> There are no data in the 'file' and 'file_link' tables.
5. Do you use mod_rewrite --> I have tried both 'subdomain' and 'subdirectory'
<VirtualHost 192.168.50.6:80> DocumentRoot /apps/testapp/wacko_test1/htdocs/ ServerAlias wacko.kmb-note <Directory /apps/testapp/wacko_test1/htdocs/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>and this
and in the .htaccess (for subdir)
<IfModule mod_rewrite.c> <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE on </IfModule> RewriteEngine on RewriteBase /wacko_test1/ RewriteRule ^(index.php?.*)$ - [S=1] RewriteRule ^(.*)$ /wacko_test1/index.php?page=$1 [QSA,PT,L] </IfModule>Thanks and regards
Re: Cannot refer to uploaded files
The WackoFormatter parses then the
file:link and can't find the corresponding record in the file table.Did you upgrade or downgrade the wiki? Please check if the file table has no missing or changed fields, this can happen if you changed the version without using the installer. The SQL script probably fails to insert the file record due to DB structure discrepancies.
Please check the file table against the file table schema for your version.
Fix the DB structure discrepancies by hand or run a fresh install with the version you want use. Additionally you can turn on the debug option, so it will show you all failed SQL queries in the footer, look out for
-1.https://github.com/WackoWiki/w[...]page/upload.php#L267 (Example for WackoWiki 6.1)
Re: Cannot refer to uploaded files
did you upgrade or downgrade the wiki?
> It's new fresh install 6.0.25.zip
I created the database
and then followed the install instruction. there is no error except upload file.
I tried to enable debug mode
const PHP_ERROR_REPORTING = 5and got this message in the
/etc/httpd/logs/error_logthanks and regards,
Re: Cannot refer to uploaded files
If you want find the error turn debugging on (including SQL queries, see system section in Admin panel) and comment out
https://github.com/WackoWiki/w[...]page/upload.php#L309
Comment out this line and read the SQL log for errors.
# $this->http->redirect($this->href('filemeta', '', ['m' => 'show', 'file_id' => (int) $file['file_id']]));Admin Panel -> System -> Debug mode
Re: Cannot refer to uploaded files
This is the debug output:
Program execution statistics Memory allocated: 4.00 MiB Overall time taken: 0.055 sec. Execution time: 0.052 sec. SQL time: 0.003 sec. SQL queries: 13 SQL queries dump follows: SELECT p.*, u.user_name, o.user_name AS owner_name FROM wacko_page p LEFT JOIN wacko_user o ON (p.owner_id = o.user_id) LEFT JOIN wacko_user u ON (p.user_id = u.user_id) WHERE tag = 'test' LIMIT 1 [0.0005 sec., 1 rows] SELECT c.category_id, c.category, c.category_lang FROM wacko_category c INNER JOIN wacko_category_assignment ca ON (c.category_id = ca.category_id) WHERE ca.object_id = 18 AND ca.object_type_id = 1 [0.0002 sec., 0 rows] SELECT watch_id, comment_id, pending FROM wacko_watch WHERE user_id = 3 AND page_id = 18 LIMIT 1 [0.0001 sec., 1 rows] SELECT file_id FROM wacko_file_link WHERE page_id IN (18) [0.0001 sec., 0 rows] SELECT to_page_id, to_tag FROM wacko_page_link WHERE from_page_id IN (18) [0.0001 sec., 0 rows] SELECT SUM(file_size) AS used_user_quota FROM wacko_file WHERE user_id = 3 LIMIT 1 [0.0005 sec., 1 rows] SELECT SUM(file_size) AS used_quota FROM wacko_file LIMIT 1 [0.0004 sec., 1 rows] INSERT INTO wacko_file SET page_id = 18, user_id = 3,file_name = 'image_210.png', file_lang = 'en', file_description = '', file_size = 146011,picture_w = 1600,picture_h = 1030,file_ext = 'png',mime_type = 'image/png',uploaded_dt = '2022-05-04 15:00:41',modified_dt = UTC_TIMESTAMP() [0.0002 sec., -1 rows] SELECT COUNT(file_id) AS n FROM wacko_file WHERE 1=1 AND page_id = 18 AND deleted <> 1 LIMIT 1 [0.0002 sec., 1 rows] UPDATE wacko_page SET files = 0 WHERE page_id = 18 LIMIT 1 [0.0002 sec., 0 rows] SELECT COUNT(file_id) AS n FROM wacko_file WHERE 1=1 AND user_id = 3 AND deleted <> 1 LIMIT 1 [0.0002 sec., 1 rows] UPDATE wacko_user SET total_uploads = 0 WHERE user_id = 3 LIMIT 1 [0.0001 sec., 0 rows] SELECT file_id FROM wacko_file WHERE file_name = 'image_210.png' AND page_id = 18 LIMIT 1 [0.0001 sec., 0 rows] Language data Multilanguage: false HTTP_ACCEPT_LANGUAGE set: true HTTP_ACCEPT_LANGUAGE value: en-US,en;q=0.5 User agent language: en User language set: true User language value: en Page language: en Config language: en User selected language: en Charset: utf-8 HTML Entities Charset: UTF-8 MySQL character set character_set_client: utf8mb4 character_set_connection: utf8mb4 character_set_database: utf8mb4 character_set_filesystem: binary character_set_results: utf8mb4 character_set_server: utf8mb4 character_set_system: utf8 collation_connection: utf8mb4_unicode_520_ci SQL mode set GLOBAL: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION SESSION: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION Session data session_id(): 7613U41sIKPPTCyhSXB5m Base URL: http://wacko.kmb-note/ Rewrite Mode: on HTTP_MOD_ENV: on HTTP_MOD_REWRITE: on HTTPS: off IP-address: 0.0.0.0 SERVER_PORT: 80 TLS: on TLS implicit: off Cookie path: /I have tried 6.0.30 too, but the installation stopped before creating tables. I think I will create another thread for this problem.
Re: Cannot refer to uploaded files
[0.0003 sec., -1 rows]as expectedINSERT INTO wacko_file SET page_id = 18, user_id = 3,file_name = 'image_28.png', file_lang = 'en', file_description = '', file_size = 146011,picture_w = 1600,picture_h = 1030,file_ext = 'png',mime_type = 'image/png',uploaded_dt = '2022-05-04 14:52:29',modified_dt = UTC_TIMESTAMP() [0.0003 sec., -1 rows]Put the query as is for example in phpMyAdmin and it will tell you what is missing or wrong. And please upgrade to 6.0.30.
This is the output of my test with WackoWiki 6.0.30:
Re: Cannot refer to uploaded files
This is the error
I changed the default value
and it works..... YEAAA.....
Thanks WikiAdmin
Re: Cannot refer to uploaded files
constants.php
config.php
Can you please provide a patch.
Re: Cannot refer to uploaded files
I have tried
and config.php already set to
change back
The result is :
wacko/setup/database_mysql.php$tbl_file = "CREATE TABLE {$pref}file ( file_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, page_id INT(10) UNSIGNED NOT NULL DEFAULT '0', user_id INT(10) UNSIGNED NOT NULL DEFAULT '0', file_name VARCHAR(255) NOT NULL DEFAULT '', file_lang VARCHAR(5) NOT NULL DEFAULT '', file_description VARCHAR(255) NOT NULL DEFAULT '', -- caption TEXT NOT NULL, <<=== change to: caption TEXT, author VARCHAR(255) NOT NULL DEFAULT '', source VARCHAR(255) NOT NULL DEFAULT '', source_url VARCHAR(255) NOT NULL DEFAULT '', license_id INT(10) UNSIGNED NOT NULL DEFAULT '0', uploaded_dt DATETIME NULL DEFAULT NULL, modified_dt DATETIME NULL DEFAULT NULL, file_size INT(10) UNSIGNED NOT NULL DEFAULT '0', picture_w INT(10) UNSIGNED NOT NULL DEFAULT '0', picture_h INT(10) UNSIGNED NOT NULL DEFAULT '0', file_ext VARCHAR(10) NOT NULL DEFAULT '', mime_type VARCHAR(255) NOT NULL DEFAULT '', deleted TINYINT(1) UNSIGNED NULL DEFAULT '0', PRIMARY KEY (file_id), UNIQUE idx_page_id (page_id, file_name), KEY idx_page_id_2 (page_id, uploaded_dt), KEY idx_deleted (deleted), KEY idx_user_id (user_id) ) {$engine} COMMENT='' {$charset} {$collation}";