Connecting Tech Pros Worldwide Help | Site Map

changing upload folder for images

Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#1: Apr 20 '09
Hi, I wonder if anyone could tell me if there is a default upload folder for image uploads in this code or if the code references another file. It works fine but I am trying to change the upload folder for images and cannot find where its done.

This bit confuses me as the application gcp, I simply dont know where it is. The only include in this page is just an upload include that has no other includes in it.
If anyone can explain the application bit that would be great.
Thanks
Richard

strFileUploadPath=Application("gcp_PathImageUpload s")


Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3.     <!--#Include File="upload2.asp"-->
  4.  
  5. ' Create the FileUploader
  6. Dim Uploader, File
  7. Set Uploader = New FileUploader
  8.  
  9. 'On Error Resume Next
  10.  
  11. ' This starts the upload process
  12. Uploader.Upload()
  13.  
  14. ' Check if any files were uploaded
  15. If Uploader.Files.Count = 0 Then
  16.     Response.Write "No file(s) have been uploaded."
  17. Else
  18.  
  19.     ' Loop through the uploaded files
  20.     For Each File In Uploader.Files.Items
  21.  
  22.             ' Save the file
  23.             strFileUploadPath=Application("gcp_PathImageUploads")
  24.  
  25.             'check if file exists
  26.             strFileNameTemp=""
  27.             set fs=Server.CreateObject("Scripting.FileSystemObject")
  28.             If fs.FileExists(Application("gcp_PathImageUploads") & File.FileName)=True Then
  29.                 Dim MyNewRandomNum
  30.                 Randomize
  31.                 MyNewRandomNum = int(Rnd * 198300)+1
  32.                 strFileNameTemp=MyNewRandomNum & File.FileName
  33.                 File.FileNameNew strFileNameTemp
  34.             Else
  35.                 strFileNameTemp=File.FileName
  36.             End If
  37.  
  38.  
  39.             File.SaveToDisk strFileUploadPath
  40.             FileContentType1=File.ContentType
  41.             FileSize1=File.FileSize
  42.             If Trim(FileName1)<>"" Then
  43.                 FileName1=FileName1 & ","
  44.             End If
  45.             FileName1 =FileName1  & File.FileName
  46.             strFileName=Application("gcp_URLImageUploads") & FileName1 
  47.  
  48.     Next
  49. End If
  50.  
  51. If Err.Number>0 Then
  52.     Response.Write "Error Number: " & Err.Number
  53.     Response.Write "<br>Description " & Err.Description
  54.     Response.write "<br>There is no specified upload folder."
  55. End If
  56.  
  57. If Err.Number>0 Then
  58.     strMessage="There is no specified upload folder."
  59.     Response.End
  60. End If
  61.  
  62.  
  63. %>
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Apr 21 '09

re: changing upload folder for images


Richard,

It looks like the code in question is in the upload doc, but it also looks like some odd object is being created, and I'd be surprised if that is in the include file.

Jared
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#3: Apr 24 '09

re: changing upload folder for images


Thanks Jared, Thanks. No you are right it wasnt. It was in another file. I worked around it by quering the "URLImageUploads" field in the database right from the page itself. Worked anyway!
Thanks
Richard
Reply