Multiple file uploads via form

BathroomFeeling

Senior member
Apr 26, 2007
210
0
0
I have a form which'll allow users to upload one image file at a time. I plan on keeping it this way, but I have a question. I'd like to know if it's possible for two files to be uploaded based on a selection of just that first file?

So for example if I have a file "image_blahblah.jpg", I'd like for the PHP script to also acquire the file "thumb_image_blahblah.jpg" (in the same subdirectory on disk) for upload behind the scenes. Both files have the same name, with the exception of the prefix "thumb_" on the second file, and there'll always be that second file on disk.

Thanks.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
php cannot grab the 2nd file on it's own, the user will need to select both files.

however, php can CREATE the thumbnail upon uploading.
 

BathroomFeeling

Senior member
Apr 26, 2007
210
0
0
Oh, well that's too bad, was hoping it could work.

As for PHP generated thumbs, yes I've successfully accomplished this before as a modified Oscommerce add-on (that CMS doesn't have it integrated). However I'm not sure about it as it seems to be process heavy, I wouldn't want my client to have to deal with any issues on her end from the host. And there's also another issue with that route, the larger images will all be watermarked, whereas the thumbs won't/shouldn't (request of client). So I'll either have to generate the thumbs from a separate batch of large images, or introduce PHP watermark processing into the mix which isn't ideal.

I guess I'll just have to split the file upload process between the large and small images, and compare whether the files match in name after upload.


Thanks anyways!
 

BathroomFeeling

Senior member
Apr 26, 2007
210
0
0
Yes indeed, but as stated, they use quite a bit of processing power from the server, triple if it's downsizing plus watermarking for the large samples, and then downsizing the originals again for the thumbs. And for a site with lots of images, this might be a problem for my client. Her hosting plan is quite basic, so I'd rather that I pre-process them on my end to prevent any issues with her and her host. Thanks though.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
i was referring to processing them once upon upload, not on the fly when the images are displayed.
 

BathroomFeeling

Senior member
Apr 26, 2007
210
0
0
Yes I understand, I have experience with ImageMagick in OSCommerce. The resize happened only once, saving the result in a new file, and thereafter every other visit by anyone else would view that image instead of re-processing it. It works great for sites with a few dozen to a few hundred images, server load won't be much of an issue. Not so in my case. Anyway thanks for the help.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
maybe it's only an issue on a shared hosting environment
i've used it on thousands of images uploaded by a community of 1.3 million members without issue, but we're not on a shared server.