PDA

View Full Version : Direct Link to Attachments


tfw2005
07-25-2005, 03:42 PM
Is there any hack, or can one be done, that when a person uploads the attachment via the normal upload system, the link in the corresponding post, shows up as a direct link to the file, not a php string driven url?

Like, you upload, and then it shows http://yoursite.com/attachments/file.jpg etc etc?

I am trying to reduce overall stress on my server by removing unnecessary database calls. I know I will lose tracking stats related to attachments, but, I really do not care about that at the moment.

I think if this system is in place, placing an anti-remote file linking setting will also work.

Thanks in advance.

EDIT: In relation to images, I would like the thumbnail system to stay in affect, so in theory the hack would produce

<a href="http://www.yoursite.com/attachments/file.jpg"><img src="http://www.yoursites.com/attachments/filethumb.jpg"></a>

tfw2005
08-03-2005, 05:01 AM
bump

anything?

Marco van Herwaarden
08-03-2005, 05:10 AM
Do you have your attachments stord in the database, or in the file system?

tfw2005
08-03-2005, 03:53 PM
file system

i looked in the folder, and they are just a string of code, file names get removed and no extentions.

Zachery
08-03-2005, 04:37 PM
Then there is almost no stress being placed on the system via the attachment systems.

Marco van Herwaarden
08-03-2005, 04:57 PM
They will have the attachmentid as name i think.

And they are stored in a subdirectory based on teh userid:

User id: 54321

Directory: images/attach/5/4/3/2/1/

Zachery
08-03-2005, 05:00 PM
They will have the attachmentid as name i think.

And they are stored in a subdirectory based on teh userid:

User id: 54321

Directory: images/attach/5/4/3/2/1/

It depends Marco how the attachment directory was originaly setup, if its under the webroot it can have any path it wants, actually it can have any path it wants perioid.

The attachments are stored as .attach and .thumb (for thumbnails) so there is no way to direct link to them without re-writing the entire system almost.

Ontop of all that you'd lose any sort of permissions you had on attachments if someone knew the url.

tfw2005
08-04-2005, 09:02 PM
Thanks guys, I figured what you said was true but just checking.

The main thing that kills us regarding attachments is that we are using a portal system on the main page, and when hot or new images are released, everyone loads that page and clicks the thumbnail, even if we have the full gallery in a non DB/VB system.

Once we stopped using thumbs on main page via the attachment system, the crashes became less frequent immediately.

I rigged a form upload with auto thumb creation in the newthread bit which only admins/staff can see, and it outputs the thumb-with-link-to-full code, so they can copy paste it into thread. 1 extra step than regular attach file process via VB. Looks same to users, better for server.

If we are going to get slammed with image requests, Id rather not have to access the DB period. That is....

Am I correct in thinking that when attachment.php is called, it has to access the physical file location in the DB and then load the image/file into the browser?