Yetishare PHP script Error : My client has been using Yetishare file hosting script on his website and came up with a complaint that the script was not allowing users to download files. Also the script displayed a vague message “Failed to generate download link”. So if you are facing similar issue, then you may want to check the below solution (with a disclaimer – I’m not really sure why this error occurred at first, because the script was working fine and suddenly it failed to generate download link. Moreover, I’m not sure if the below solution might have any side effect. So what’s more important here is, it worked for me and it may not work for everyone. Deal?)
Well, here’s what I did.
Step 1: Open file.class.php (it should be located under core/includes folder)
$ vim core/includes/file.class.php
Step 2: Look out for the variable $userId at line 2918 (might differ based on version). You should probably see the value as empty string – something like the one shown below.
$userId = ' ';
Step 3: Now set the value of $userId to zero.
$userId = '0';
Step 4: Save and quit vim.
Step 5: Try downloading the file as non-logged-in user and it should work.
You want to know the reason? Just remember the deal 🙂
I love bugs and I love fixing them!