Forum OpenACS Q&A: Re: Problems downloading large files...

Collapse
Posted by Don Baccus on
Switching to ns_returnfile should be *within* cr_write_content, you shouldn't remove the abstract call because it works with blobs as well as files.

And ... since apparently you're storing your large data as blobs rather than in the file system cr_write_content will need to use write_blob anyway.

Is there any reason not to believe the error message, i.e. that i/o failed?  As in a socket hiccup or something similar?

Collapse
Posted by Robert Locke on
Hi Don...

> Switching to ns_returnfile should be *within*
> cr_write_content, you shouldn't remove the abstract call
> because it works with blobs as well as files.

Absolutely, that's what I meant by 'changing "cr_write_content" to *use* "ns_returnfile"'.

I actually am storing the data in the file system, NOT the database. The original "cr_write_content" calls "db_write_blob" even when the storage type is "file". "db_write_blob" then calls "db_exec_lob write_lob", which then calls "ns_writefp $ofp" when storage_type = "file", which is in my original error message posted above. So I am using the file system.

I guess I would believe the i/o error message except that it seems to happen quite frequently. Also, someone else posted a similar problem here, so maybe there's something more to this.

In any case, I updated "cr_write_content" to use "ns_returnfile" as per Jeff's suggestion. Ultimately, it boils down to using ns_returnfile instead of ns_writefp to deliver the content to the end user. I haven't dug deeper into the internals of those calls, but do you think it would make any difference?

Thanks...