Good solution but watch out!

October 29, 2004 by Charles Beaudry

Tjis solved one of the problems I ran into during development of a CMS. If you are using the script for multiple areas and multiple extensions, I suggest you create a second file and manually change the include statement at the top.

In my case, I needed to upload .css and images files to specific folders simultaneously. These modifications did the trick. However, in another part of my CMS, the images were being uploaded to a different folder. As a result, I had to create two separate "incPureUpload.asp" files, one for the normal routine, and one for the multiple file upload routine. Then I manually edited the include path in the page where the separate forms resided to point to the right routine.

Now everything works great.

3 images to upload

July 28, 2005 by Stephen Davidson
I have 3 images to upload, a low res JPG, a medium res JPG and and high res ZIP file, could the above method be adapted to upload these three files to three diferent folders? Many thanks... Stephen

RE: 3 images to upload

July 29, 2005 by Jim Castanes

I would think that you could, as long as you keep a common standard for all your file naming.

In my example I was looking for a "zip" file extension in the "GP_CurFileName" variable. I would suggest naming your low res files something like “filenameLo.jpg“ and your high res files something like “filenameHi.jpg”.(Of course you can use whatever naming you choose)

Then to set the variable for the path do the following:

'Get the path
GP_CurFileName = UploadRequest.Item (GP_curKey).Item("FileName")
Dim varExt
Dim varPath
varExt =Right(GP_CurFileName,6)
If varExt = "Lo.jpg" Then
varPath = "LowRes"
Elseif varExt = "Hi.jpg" Then
varPath = "HiRes"
Else
varPath = "Zip"
End If

This will look for your hi and low res jpg files and anything else(which will be your zip files) will go into your zip folder.

RE: RE: 3 images to upload

July 29, 2005 by Stephen Davidson
Thanks for the reply Jim, i have it working a treat now, and it has got me thinking. Would it not be easier to use the If Then Else dependant on the file field names? I mean on my form I have the three upload fields named accordingly, surely the upload component can pick up on this which would mean that we don’t need to check the charters in the filename etc and it would allow for all kinds of permutations.. Just a thought! And thanks again. Stephen
See all 8 Comments