dopetalk does not endorse any advertised product nor does it accept any liability for it's use or misuse


Our Discord Notification Server invitation link is https://discord.gg/jB2qmRrxyD

Author Topic: Ways to Avoid Browser Woes When Attaching Large Files  (Read 16 times)

Offline Chip (OP)

  • Server Admin
  • Admin
  • Hero Member
  • ****
  • Administrator
  • *****
  • Restrictive
  • *
  • RC Discussion
  • **
  • Private
  • ***
  • Owner
  • *****
  • Join Date: Dec 2014
  • Location: Australia
  • Posts: 7390
  • Reputation Power: 0
  • Chip has hidden their reputation power
  • Gender: Male
  • Last Login:Today at 05:42:31 AM
  • Deeply Confused Learner
  • Profession: IT Engineer now retired
Ways to Avoid Browser Woes When Attaching Large Files
« on: Yesterday at 06:19:12 PM »
📎 Click on me to view all my attachments
ListAttBBC  |  v6.12  |  2026-09-10  |  Andrew.human & Claude.ai
#FileSizeDownloadsInfoDL
00Browser attachment save diagnostics - Claude.pdf  [native]580.2 KB3ℹ️⬇️
01attach_saved_display327 B1ℹ️⬇️
02attach_saved_watch1.1 KB2ℹ️⬇️
03attachme1.2 KB2ℹ️⬇️


#
# This script expects you to parse it a fully pathed filename.filetype ($1)
#

ATTACH FILES FASTER THROUGH THIS BACK DOOR ---

1. You must know where your files are and their names (you process one at a time only)
- eg. /root/"Fabulous Video About Everything You Need to Know Living in the Grey Zone".mp4
- note the double-quotes around the filename because it contains embedded blanks.

2. You must know the msg  number of the post's URL when opened -
  -- eg, this very post has msg=49662  > ("https://forum.drugs-and-users.org/index.php?action=post;msg=49662;topic=7884")
2.

📝 Inline Markdownv4.4 · 2026-09-05
#
# The faster way to attach an item to a post
#
# Source:
SRC=$1

# msg no. from the URL currently displaying
# the post that want to attach to:

# 47482 = 'A classic LGBT party from 1990 and Kylie's closing track'
#SG=49629 MISTAKE SO REMOVER LATER
MSG=47482

# SMF's attachment dirs:
FOLDER=2
DIR=/var/www/html/attachments2

# SMF's Database:
DB=smf209; P=smf209_

[ -f "$SRC" ] || { echo "no such file: $SRC"; return 2>/dev/null || exit 1; }
[ "$MSG" = 12345 ] && { echo "set MSG first"; return 2>/dev/null || exit 1; }

NAME=$(basename "$SRC"); EXT="${NAME##*.}"
SIZE=$(stat -c%s "$SRC"); MIME=$(file -b --mime-type "$SRC")
HASH=$(echo "$NAME$(date +%s%N)$RANDOM" | sha1sum | cut -c1-40)

ID=$(mysql -N "$DB" -e "
INSERT INTO ${P}attachments
  (id_folder,id_msg,id_member,attachment_type,filename,file_hash,fileext,size,mime_type,approved)
SELECT $FOLDER,$MSG,id_member,0,'$NAME','$HASH','$EXT',$SIZE,'$MIME',1
FROM ${P}messages WHERE id_msg=$MSG;
SELECT LAST_INSERT_ID();")

echo "ID=[$ID] HASH=$HASH MIME=$MIME SIZE=$SIZE"
if [ -n "$ID" ] && [ "$ID" != 0 ]; then
  cp -n "$SRC" "$DIR/${ID}_${HASH}" && chown apache:apache "$DIR/${ID}_${HASH}"
  ls -l "$DIR/${ID}_${HASH}"
else
  echo "INSERT failed (bad MSG or mysql auth) - nothing copied"
fi
« Last Edit: Yesterday at 06:52:55 PM by smfadmin »
friendly
0
funny
0
informative
0
agree
0
disagree
0
like
0
dislike
0
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
Our Discord Server invitation link is https://discord.gg/jB2qmRrxyD

Tags:
 


dopetalk does not endorse any advertised product nor does it accept any liability for it's use or misuse





TERMS AND CONDITIONS

In no event will d&u or any person involved in creating, producing, or distributing site information be liable for any direct, indirect, incidental, punitive, special or consequential damages arising out of the use of or inability to use d&u. You agree to indemnify and hold harmless d&u, its domain founders, sponsors, maintainers, server administrators, volunteers and contributors from and against all liability, claims, damages, costs and expenses, including legal fees, that arise directly or indirectly from the use of any part of the d&u site.


TO USE THIS WEBSITE YOU MUST AGREE TO THE TERMS AND CONDITIONS ABOVE


Founded December 2014
SimplePortal 2.3.6 © 2008-2014, SimplePortal