File upload

Submitted by SteveBird on 2017-03-14

Hi, I have successfully installed and started to use WebIssues - great system! Only function I can't get to work is attaching files to issues.

As soon as you click the OK button in the 'Add Attachment' page the msg 'An error occurred while uploading the file' is displayed.

I have followed the advice in the manual about configuring PHP and the various file size params. I am not entirely sure where files greater than the 'store in database' setting are stored so can't check the directory permissions.

Any advice on where I should continue looking?

Many thanks,

Steve

php.ini
sys_temp_dir = /tmp
upload_tmp_dir = /tmp
memory_limit = 500M
upload_max_filesize = 1500M

drwxr-xr-x 4 www-data www-data 4096 Aug 10 2015 data
drwxr-xr-x 3 www-data www-data 4096 Feb 28 09:29 sites
drwxr-xr-x 3 www-data www-data 4096 Mar 14 09:30 default
drwxr-xr-x 2 www-data www-data 4096 Mar 14 09:30 storage

These files are stored in the data/sites/default/storage subdirectory. Does the error occur only for larger files or also for small files?

Regards,
Michał

Hi Michał,

Thank you for your quick reply, much appreciated.

The current setting for db vs local file system is at the default 4kb and interestingly if the file size for the uploaded file is less than 4k all works as expected.

I've looked in the logs (WebIssues / apache) and cannot see anything untoward.

We are attaching files up to 1GB and typically not less than 1 or 2MB.

Thanks,

Steve

I am still looking at this problem. Have updated/upgraded linux to ensure all is on the most recent version. Uses phpadmin to look for php params that may have a role in this problem (none found other than ones mentioned ealier). Looked through the mysql ini files (a challenge to figure out which is the last one it loads!), maxed out a few based on web searches. All to no avail. I have not been able to see any pattern for the failure.

The default.log records the sql and does not seem to indicate a problem - except the file is not added to the DB.
[2017-03-22 08:51:20, 192.168.6.22]

Running script: /client/issues/addattachment.php
SQL Query: SELECT server_name, server_uuid, db_version FROM rfid_server
Query execution time: 0.8 ms
Returned rows: 1
SQL Query: SELECT set_key, set_value FROM rfid_settings
Query execution time: 0.4 ms
Returned rows: 17
SQL Query: SELECT s.session_id, s.session_data, s.last_access, u.user_id, u.user_name, u.user_access FROM rfid_sessions AS s JOIN rfid_users AS u ON u.user_id = s.user_id WHERE s.session_id = ?
Query execution time: 2.0 ms
Returned rows: 1
SQL Query: SELECT pref_key, pref_value FROM rfid_preferences WHERE user_id = ?
Query execution time: 1.9 ms
Returned rows: 0
Executing page: Common_Issues_AddAttachment
SQL Query: SELECT i.issue_id, i.issue_name, i.stamp_id, i.stub_id, i.descr_id, i.descr_stub_id, f.folder_id, f.folder_name, p.project_id, p.project_name, p.is_public, t.type_id, t.type_name, s.state_id, s.read_id, s.subscription_id, sc.stamp_time AS created_date, uc.user_id AS created_user, uc.user_name AS created_by, sm.stamp_time AS modified_date, um.user_id AS modified_user, um.user_name AS modified_by, ? AS project_access FROM rfid_issues AS i JOIN rfid_stamps AS sc ON sc.stamp_id = i.issue_id JOIN rfid_users AS uc ON uc.user_id = sc.user_id JOIN rfid_stamps AS sm ON sm.stamp_id = i.stamp_id JOIN rfid_users AS um ON um.user_id = sm.user_id JOIN rfid_folders AS f ON f.folder_id = i.folder_id JOIN rfid_projects AS p ON p.project_id = f.project_id JOIN rfid_issue_types AS t ON t.type_id = f.type_id LEFT OUTER JOIN rfid_issue_states AS s ON s.issue_id = i.issue_id AND s.user_id = ? WHERE i.issue_id = ? AND p.is_archived = 0
Query execution time: 3.4 ms
Returned rows: 1
Total execution time: 31.5 ms

Any pointers as to what I could look at next?

Many thanks, Steve

If the problem occurs for files larger than 4k, then it's related to moving the uploaded file to the storage subdirectory. On the DB and PHP side everything seems to be normal.

Regards,
Michał