Print Page | Close Window

Image Upload to Database

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Rich Text Editor (RTE)
Forum Description: Support forum for the Web Wiz Rich Text Editor (RTE).
URL: https://forums.webwiz.net/forum_posts.asp?TID=27683
Printed Date: 28 March 2026 at 5:29pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Image Upload to Database
Posted By: Chappers2000
Subject: Image Upload to Database
Date Posted: 12 August 2009 at 11:36pm

Firstly, great app WebWiz.  Exactly what I needed.

The only thing that is preventing me placing this RTE into full production is that any images or files users upload to my site are visible and available to all as they all upload into the my_documents folder.  I have tried doing the below and it causes an error when trying to load the RTE page.  Presumably because a folder called the variable session("USERNAME") doesn't exist yet.
 
Const strImageUploadPath = Session("USERNAME") & "\my_documents\my_pictures"
 
Does WebWiz have functionality to upload to a database, is this planned for a future release.  Or can one get the permission to add in their own upload component that does? Or can anybody advise how a folder can be created at upload based on the session("USERNAME") and can that be hidden from other users?
 
Many thanks



Replies:
Posted By: WebWiz-Bruce
Date Posted: 13 August 2009 at 9:36am
Uploading images and files to a database is almost never done as it servilely reduces performance and very quickly fills up your database.

What you would need to do is to modify the code to add in some extra code using the FSO object to create the folder for the user if it doesn't already exist.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Chappers2000
Date Posted: 13 August 2009 at 10:23am
Many thanks for the speedy reply Bruce.  I am going to assume from your replay that it is ok under the license agreement to make such an amendment and will do so.
 
I was not aware that images in the database reduced performance, so thanks for the tip.
 
 


Posted By: Chappers2000
Date Posted: 16 August 2009 at 12:31pm
Just in case anybody was wondering how I achieved it in the end.  I personally hate it when people do not post their solutions.  Below is the code I added to the the RTE_setup.asp file.  It works great.
 
'File Attachments
Const blnAttachments = true 'Attach files to the editor contents

dim thbasicpath, myfs, strFileUploadPath
thbasicpath = "my_documents\my_files"
Set myfs=Server.CreateObject("Scripting.FileSystemObject")
If myfs.FolderExists(Server.MapPath(thbasicpath) & "\" & session("UserID") & "_Files") = true Then
 strFileUploadPath = thbasicpath & "\" & session("UserID") & "_Files"
Else
 myfs.CreateFolder(Server.MapPath(thbasicpath) & "\" & session("UserID") & "_Files")
 strFileUploadPath = thbasicpath & "\" & session("UserID") & "_Files"
End if

'Const strFileUploadPath = "my_documents\my_files"
Const strFileTypes = "zip;rar;doc;pdf;txt;rtf;htm;html;gif;jpg;png" 'Separate file types with ;
Const intMaxFileSize = 2048 'Use AspUpload 3.x or above for uploads over 2048KB (size in KB)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net