Roger Posted August 21 Posted August 21 Can someone please advise what I am missing / misunderstanding? I have used FTP to upload a file here mydomain/cubecart/public/testdirectory/test.jpg When I edit my test product to add the file - Dashboard > Products > Testproduct > Digital > Browse to my test directory I cannot see my test file (test.jpg) Should I be able to see and add it? Quote
bsmither Posted August 21 Posted August 21 Are you sure you uploaded it to here? /mydomain/cubecart/public/testdirectory/ Because a CubeCart installation has, as the directory for files to be downloaded: /mydomain/cubecart/files/public/testdirectory/ In admin, CubeCart's FileManager for downloadable files will always want to look in /files/, then show the files and folders from that location. Additionally, uploading via means other than under CubeCart's control will not get the files logged in the database. In admin, Downloads, there is an "Update File List" tab which will scan /files/ (and any subfolders) and get those new uploads logged into the database. Quote
Roger Posted August 22 Author Posted August 22 Thank you both for your replies. bsmither - you are correct, my typo, sorry! I have made some progress with the help of your info about the "Update File List" tab, however the file manager is not showing all the files in the directory. My FTP client shows 30 JPGs of various sizes in my /files/public/topographia directory but Cubecart file manager only shows 27. I cannot see any obvious reason as during different tests different files are missing. Any thoughts? Quote
Roger Posted August 22 Author Posted August 22 Further info Interestingly all 30 JPGs are listed in the SQL table Table: CubeCart_filemanager but the (original install) test item's "Digital" tab only lists 27 JPGs. Quote
bsmither Posted August 23 Posted August 23 Just to be clear, the 30 JPGs in the CubeCart_filemanager, all have a 'type' = 2? Quote
Roger Posted August 23 Author Posted August 23 I have looked more carefully at the DB table and whilst the IDs run from 1-30 IDs 21, 22 & 23 are missing So there are 27 files with an ID=2 Quote
bsmither Posted August 23 Posted August 23 So, 'file_id' = 21, 22, and 23 are not in CubeCart_filemanager, where ALL of the rows have 'type' = 2? There are no 'type' = 1 at all? Quote
Roger Posted August 23 Author Posted August 23 That is correct there are no 'type' = 1 files Just 27 'type' = 2 Quote
bsmither Posted August 23 Posted August 23 We wait in anticipation to learn what files were FTP'd to the folder, but didn't end up in the database. Quote
Roger Posted August 23 Author Posted August 23 www.sorbaskarst.com/cc-file-man.jpg www.sorbaskarst.com/FTP-files.jpg Here are a couple of screen shots Quote
bsmither Posted August 23 Posted August 23 The file 00066a, 70a, and 70b are very large. It could be that CubeCart will reject very large files that are over a certain limit. The 00006b file is also very large but maybe just under the limit. Quote
Roger Posted August 23 Author Posted August 23 So there is a size limit for digital content? As simple as that Quote
bsmither Posted August 23 Posted August 23 (edited) For images that CubeCart wants to use as images, very much yes, there is a very practical limit (about 350KB). But downloadable files that happen to be images, I think, no, there is (probably) no limit. "So, 'file_id' = 21, 22, and 23 are not in CubeCart_filemanager." The obvious question, where did those rows go? Edited August 23 by bsmither Quote
Roger Posted August 23 Author Posted August 23 (edited) Yes, it is as simple as that. I reduced the file size and now they all show in CC file manager and in the SQL table. Thanks very much for your help on this, much appreciated Edited August 23 by Roger Quote
bsmither Posted August 23 Posted August 23 The Filemanager class has the class attribute '_md5_filesize_limit' set to 10485760. There is a function in the Filemanager class that, in turn, calls PHP's md5_file function, but only if the filesize is less than the self-imposed limit. If larger, the class function returns an empty string. So, there will either be a 32-character hash string, or an empty string assigned to an array element 'md5hash', that matches the column name in CubeCart_filemanager, in the array being attempted to get inserted. The call to CubeCart's database insert() function will look at the array and (for reasons unknown) remove those columns from the SQL query being built, where the column value is "empty". Looking at CubeCart_filemanager, the 'md5hash' column does not allow NULLs (which is, there must be a value for this column), the default value to use in such a case is not specified, and so the database engine may have simply tossed that specific SQL INSERT query in the trash. HOWEVER, when a database is not in strict mode (which CubeCart insists upon), invalid values are 'corrected' as best as possible - but I cannot determine what happens with missing column-value data. Suppose that the database engine will use an empty string for VARCHAR data types. Also notice the column 'md5hash' has (maybe) a UNIQUE index. No other row may have the same value as any other row for this column. Now, let's compare the filesize limit to the file size of 00006b: 10485760 vs 10684086. In this case, the 'md5hash' value should be an empty string, which quite probably was never seen in the SQL query by the database engine. We know that 00006b got in the database. But what is the 'md5hash' value for that row? Is it an empty string? If so, a UNIQUE index will prohibit any other INSERT where the 'md5hash' column would otherwise acquire an empty string. Quote
Roger Posted August 23 Author Posted August 23 "We know that 00006b got in the database. But what is the 'md5hash' value for that row? Is it an empty string?" - Yes This is getting a bit complex for me but I will try and keep up - thanks for your patience. This is my state of play at the moment: All my JPGs are less than 10mb I have uploaded all my 117 files via FTP Only 110 files show in CC file manager Only 110 files show in the SQL table 00006b is the only file with an empty md5hash Quote
bsmither Posted August 23 Posted August 23 Then 110 out of 117 are in the database. Are any 'file_id' values missing (other than 21, 22, and 23)? They should range from 1 to 120 (skipping over the missing 21, 22, 23). What seven files are missing from the database? Quote
Roger Posted August 23 Author Posted August 23 You are correct - it was a checksum issue. The "missing" files were intentional duplicates with different file names, Changing their size very slightly did the trick, thanks again, great job! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.