How to add large attachments to posts?

Started by jasgot, May 19, 2008, 11:01:11 PM

Previous topic - Next topic

jasgot

I have searched quite a bit and only find more questions like mine. I have files that are about 150MB that need to be attached to posts.

What is the best way to handle these files?

steighan

it all depends on the files themselves.

you could simply just include a url link to the file in the post(s)
"Frequently wrong, but never in doubt"

jasgot

Quote from: steighan on May 20, 2008, 02:03:15 AM
it all depends on the files themselves.

you could simply just include a url link to the file in the post(s)

That doesn't allow me to protect the attachments. I'd like for the attachments to only be available to registered users.

There really should be a way to attach files that are already at the server.

forsakenlad

There is a way but it isn't related to SMF. You should ask your host to increase the maximum allowed uploads through php scripts.
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

steighan

Quote from: jasgot on June 02, 2008, 08:50:29 PM
Quote from: steighan on May 20, 2008, 02:03:15 AM
it all depends on the files themselves.

you could simply just include a url link to the file in the post(s)

That doesn't allow me to protect the attachments. I'd like for the attachments to only be available to registered users.

There really should be a way to attach files that are already at the server.


make the link be to  a PHP file
i.e.
<?php
$url="/protected_folder_not_accessible_from_root/yourfilename.big";

include ssi.php;
if is_logged {
header('Content-Description: File Transfer');
       header('Content-Type: application/force-download');
     header("Content-Disposition: attachment; filename=\"".basename($url)."\";");
     header('Content-Length: ' . filesize($url));
@readfile($url) OR die();
}
?>

or you can move the file to the downloads folder, then update the database (smf_attachments) to reference the  file.
"Frequently wrong, but never in doubt"

Mr ChriZ

#5
It would be nice if there was a progress bar on uploading large files.
The uppit.com file service does this and it's a real boon to see how long it's going to take.

I've also had problems with the forum timing out when adding files.
Since I'm hosting it in my case I guess somewhere there's a timeout value possibly in IIS settings
to stop this happening, ie probably my fault  O:)

Rumbaar

Well you can 'trick' it to attach it to a post.  Upload a very small file of the same name to the post, then upload via FTP the same file over the small file (making sure to make it the same name).  Then it will be attached to the file and able to be controlled via permissions system.  You might have to manually alter the db entry to correct the file size attribute.  But it should work.

If increasing the upload file limit via PHP isn't possible.  I know it's not ideal, but it should work.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: