User Tools

Site Tools


file_storage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
file_storage [2023/05/21 00:25] – [wtkFiles Data Table] wtkadminfile_storage [2023/08/23 20:51] (current) – [SQL Data] wtkadmin
Line 17: Line 17:
 Storing images and documents as blobs in a SQL database is a horrible idea!  This makes backups take considerably longer, stresses the SQL DB by pulling the images out every time needed, plus several other reasons.  For example a DB backup I managed took 12 hours nightly due to images and documents stored in the DB as blobs.  Once it was changed to the Wizard's Toolkit method of storing the location of the file on the server, the nightly backups took less than an hour. Storing images and documents as blobs in a SQL database is a horrible idea!  This makes backups take considerably longer, stresses the SQL DB by pulling the images out every time needed, plus several other reasons.  For example a DB backup I managed took 12 hours nightly due to images and documents stored in the DB as blobs.  Once it was changed to the Wizard's Toolkit method of storing the location of the file on the server, the nightly backups took less than an hour.
  
-In the datat table the `FilePath` is stored in a separate data column than the `NewFileName`.  The reason it is called **New**FileName is because WTK renames the file during the upload process.  That way the length of the 'FileName' column only needs to be varchar(12).  The name is generated by inserting a row into the wtkGUID data table and taking the auto-incremented GUID value.  Then a 'w' is prepended and the original file extension is added.  If the file extension is **jpeg** it will be changed to **jpg**.+In the data table the `FilePath` is stored in a separate data column than the `NewFileName`.  The reason it is called **New**FileName is because WTK renames the file during the upload process.  That way the length of the 'FileName' column only needs to be varchar(12).  The name is generated by inserting a row into the wtkGUID data table and taking the auto-incremented GUID value.  Then a 'w' is prepended and the original file extension is added.  If the file extension is **jpeg** it will be changed to **jpg**.
  
 For example an uploaded file may end up with a name like `w1087.png`.  Here is an example SQL statement to pull the FirstName and file-associated columns from the wtkUsers table (the FirstName is not relevant for file upload but likely to be needed on the page. For example an uploaded file may end up with a name like `w1087.png`.  Here is an example SQL statement to pull the FirstName and file-associated columns from the wtkUsers table (the FirstName is not relevant for file upload but likely to be needed on the page.
Line 48: Line 48:
   * $fncShowOneClickUpload defaults to 'N' but if set to 'Y' then adds button to upload using AJAX without needing a 'Save' button   * $fncShowOneClickUpload defaults to 'N' but if set to 'Y' then adds button to upload using AJAX without needing a 'Save' button
   * $fncAccept defaults to 'accept="image/*"'; you can change this to other document filters like accept=".pdf"   * $fncAccept defaults to 'accept="image/*"'; you can change this to other document filters like accept=".pdf"
-  * $fncThumbnail defaults to 'N'; if set to 'Y' then adds an <img id="imgPreview" ...> which will show a preview of images+  * $fncThumbnail defaults to 'N'; if set to 'Y' then adds an <img id="imgPreview" ...> which will show a preview of images but only if it is stored locally
  
 ===== Public Files ===== ===== Public Files =====
file_storage.txt · Last modified: 2023/08/23 20:51 by wtkadmin