Jump to content

Add file via FTP for digital download item


Roger

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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 by bsmither
Link to comment
Share on other sites

Posted (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 by Roger
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

"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

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...