problem with added pdf files

Permalink
Hi,

I added links to numerous pdf files in my site. When I click on those links in Firefox on Mac they open just fine, but on PCs and Safari on Mac I get a message saying invalid file.

I want to get around using the add file feature and put absolute urls in the html code. But it seems impossible to figure out what the absolute urls are to my files in the file manager.

Anyone can help?

 
frz replied on at Permalink Reply
frz
can anyone else confirm this? if so lets get it posted in bugs so we don't lose it.
gelie replied on at Permalink Reply
gelie
This has to do with logged in vs guest issue, not a browser issue from what I understand.
bebop1065 replied on at Permalink Reply
I don't understand your reply. Can you explain what,

"This has to do with logged in vs guest issue..."

means?

Thanks because I'm having the same problems with attached PDFs.
agedman replied on at Permalink Reply
agedman
Sorry, but I can't confirm the "invalid file" message for PDF files on Win XP. It seems to be working fine for Firefox 3.6.8, IE 7, and Chrome. I'm using C5 version 5.4.0.5. It downloads whether or not I'm logged in. I tested with both the content block and the file block.

Maybe it's something specific to your PDF file(s). Have you tried it with a PDF that you know for sure downloads ok from other sites?
bebop1065 replied on at Permalink Reply
There is nothing wrong with the PDF. There is an issue with the installation. The file is fine.

I am only able to provide the hard link to the file in order for it to download properly.

Using the link provided by content block gives me a database error or the invalid file message.
agedman replied on at Permalink Reply
agedman
Do you have this up at a public site? If so, and if you could post the url of a page that has some of the broken PDF download links, it might help someone figure this out...
bebop1065 replied on at Permalink Reply
http://pinelandssoccer.org/index.php?cID=120

As long as I am logged in, I can download the file. As soon as I log out, I lose access to it.

The file is in a Public set.
agedman replied on at Permalink Reply
agedman
I see what you mean... It seems like a permissions issue. I think the hard link to the file is bypassing the permissions.

If you go to File Manager > Access, are guest permissions set to 'yes' for view site files? Do you have custom permissions enabled for the fileset?

It's weird that the link would work in Firefox for Mac, though -- is that still the case? I don't have a way to check that...
bebop1065 replied on at Permalink Reply
I only added the hard link once I was advised of the error by a user.

The file is in a public fileset. There are no custom permissions.

I'll try adding the log settings once I am able to get outside of this firewall.

The user that informed me of the download error is a windows user.

Thanks for the suggestions.
agedman replied on at Permalink Reply
agedman
If the permissions look fine to you, one thing you could try is opening concrete/controllers/download_file.php in an editor and temporarily inserting some log statements inside the view function(), for example:
public function view($fID = 0) {
  // get the block
  if ($fID > 0) {
    Log::addEntry('Got the file id');
    $file=File::getByID($fID);      
    if ($file) {
      Log::addEntry('Got a file')   
      $fp = new Permissions($file);
      if (!$fp->canRead()) {
        Log::addEntry('User has permissions');
        return false;
      }
etc...
You can check the log entries in Dashboard > Reports > Logs
bebop1065 replied on at Permalink Reply
Here is a log entry from this morning. It contains the file id for the PDF that errors during the download attempt.

Maybe someone can see the through all of this Greek?

Exception Occurred: mysql error: [1048: Column 'fID' cannot be null] in EXECUTE("insert into DownloadStatistics (fID, fvID, uID) values (NULL, 0, 0)")
#0 /home/xx/public_html/concrete/libraries/3rdparty/adodb/adodb.inc.php(1037): adodb_throw('mysql', 'EXECUTE', 1048, 'Column 'fID' ca...', 'insert into Dow...', false, Object(ADODB_mysql))
#1 /home/xx/public_html/concrete/libraries/3rdparty/adodb/adodb.inc.php(993): ADOConnection->_Execute('insert into Dow...')
#2 [internal function]: ADOConnection->Execute('insert into Dow...', Array)
#3 /home/xx/public_html/concrete/libraries/database.php(73): call_user_func_array(Array, Array)
#4 [internal function]: Database->__call('Execute', Array)
#5 /home/xx/public_html/concrete/models/file.php(426): Database->Execute('insert into Dow...', Array)
#6 /home/xx/public_html/concrete/controllers/download_file.php(66): File->trackDownload()
#7 /home/xx/public_html/concrete/controllers/download_file.php(26): DownloadFileController->download(Object(File))
#8 [internal function]: DownloadFileController->view('171')
#9 /home/xx/public_html/concrete/libraries/controller.php(190): call_user_func_array(Array, Array)
#10 /home/xx/public_html/concrete/libraries/controller.php(169): Controller->runTask('view', Array)
#11 /home/xx/public_html/concrete/libraries/view.php(600): Controller->setupAndRun()
#12 /home/xx/public_html/concrete/dispatcher.php(236): View->render(Object(Page))
#13 /home/xx/public_html/index.php(2): require('/home/xx/...')
agedman replied on at Permalink Reply
agedman
I see what it's saying, but it's not making sense to me yet. Basically the flow is like this:

In the view() function of the controller download_file.php, we're receiving a positive fID, using it to get an instance of the file object, checking permissions, etc.. and everything's fine...

BUT -- when we take that file object and call its TrackDownload() method to insert a record to the stats table, the ado db library is complaining that we passed it a null fID!

Something definitely seems broken in your code. I'd probably try inserting a line like
Log::AddEntry("File ID is: {$this->fID}");
right before line 426 of file.php i.e. this:
$db->Execute('insert into DownloadStatistics (fID, fvID, uID) values (?, ?, ?)',  array( $this->fID, intval($fvID), $uID ) );

I can't see how a File object could forget its own fID... Could there be a problem with the ADO connection?