Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Image Upload to Database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedImage Upload to Database

 Post Reply Post Reply
Author
Chappers2000 View Drop Down
Newbie
Newbie


Joined: 12 August 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chappers2000 Quote  Post ReplyReply Direct Link To This Post Topic: Image Upload to Database
    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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Chappers2000 View Drop Down
Newbie
Newbie


Joined: 12 August 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chappers2000 Quote  Post ReplyReply Direct Link To This Post 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.
 
 
Back to Top
Chappers2000 View Drop Down
Newbie
Newbie


Joined: 12 August 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chappers2000 Quote  Post ReplyReply Direct Link To This Post 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)


Edited by Chappers2000 - 16 August 2009 at 1:44pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.