judoscott
asked on
Upload a file from a subdomain to the main domain
I want users to be able to upload pictures from a subdomain to a folder on the mail domain. II am trying to set up my own web server using window 2003. It works on the current sever the site is on but I cannot get it to work on the new server. The code is attached. The code works on the other server so I'm wondering if it is a windows or firewall issues. I've look at both but cannot figure out how to get it to work.:
Thanks,
Scott
Thanks,
Scott
Dim MyUploader
Set MyUploader = New FileUploader
MyUploader.Upload()
Dim File
Dim myFile
Dim msErrorMsg ' holds error message if any variables are blank
msErrorMsg = ""
For Each File In MyUploader.Files.Items
File.FileName=Left(File.FileName,Len(File.FileName)-4) & "(" & request.Cookies("userID") & ")" & Right(File.FileName,4)
myFile = File.FileName
'response.Write("<br>" & File.FileSize)
if File.FileSize > 5242880 THEN
msErrorMsg = "<br> - Sorry, the picture is too big, please resize and try again!<br>"
If InStrRev(msErrorMsg, "<br>") <> Len(msErrorMsg) - 6 Then
msErrorMsg = msErrorMsg & "<br>"
End If
'Set the Session error msg for display after redirect
Session("msErrorMsg") = msErrorMsg
Session("Corrections") = "Yes"
Response.Redirect("myAccount.asp?view=purchaseAd&action=uploadPic")
END if
response.Write("<br>" & File.ContentType)
NEXT
sql="SELECT * FROM users WHERE userID=" & request.Cookies("userID") & ""
set rs=Conn.Execute(sql)
response.Write(myFile)
For Each File In MyUploader.Files.Items
File.SaveToDisk "C:\pathtofolder\images\banners\"
Next
...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sounds like we're on the right track then. The file is uploaded but the uploader/IIS doesn't have the rights to save it to the folder.
The user is usually called something like IUser and is the same one IIS uses for it's system things. But it all depends on how your uploader is configured.
The user is usually called something like IUser and is the same one IIS uses for it's system things. But it all depends on how your uploader is configured.
ASKER
I gave the IUSR admin right but it still isn't working. I'm not sure how to check the configureation of the uploader. Do you mean the upload.asp file or the MyUploader function?
Thanks,
Scott
Thanks,
Scott
I mean the FileUploader com object. There needs to be something installed on the server to be able to upload files. Whatever this is, it needs to have the appropriate run and access rights.
If it's on the server but not running, it might have to be registered using:
regsvr32 <full path and filename of the dll>
If it's on the server but not running, it might have to be registered using:
regsvr32 <full path and filename of the dll>
ASKER
I was able to upload to the subdomain just not to the main domain from the subdomain. Wouldn't that mean it is installed and registered?
If you are able to upload anything on that comptuer then yes, it's registered and working.
I'm now confused about the domain/subdomain thing. What is the domain and what is the subdomain?
I'm now confused about the domain/subdomain thing. What is the domain and what is the subdomain?
ASKER
The domain is currently an IP address. I'm trying to get the site up and running before I move it over but the way it works on the live site is that when users register on the register.tellyourtestimony .com the user uploads an image to the domain www.tellyourtestimony.com.
Scott
Scott
ASKER
Hey,
I just checked and I guess I had given the users on the main domain write permissions and not on the sub-domain. I just tried it on the sub-domain and it now works. Sorry for wasting your time. I'll give you the points since you gave me things to check and if the uploader had not be registered I would have had to go that route and for your time!
i appreciate it.
Scott
I just checked and I guess I had given the users on the main domain write permissions and not on the sub-domain. I just tried it on the sub-domain and it now works. Sorry for wasting your time. I'll give you the points since you gave me things to check and if the uploader had not be registered I would have had to go that route and for your time!
i appreciate it.
Scott
ASKER
Thanks again for your help!
ASKER
Thanks,
Scott