Skip to main content
Participant
January 15, 2007
Question

asp question

  • January 15, 2007
  • 1 reply
  • 273 views
Hi,

I'm trying to upload images using aspupload component.

This is working, but I want to be able to vary the upload directory dynamically - ie, upload to a unique directory for each user. for the purposes of this, assume that the userid corresponds to the desired upload directory, and that this will be passed in as a hidden value from the upload form to the page that does the uploading.

The following code specifies where uploaded images are saved to:


<%
Set Upload = Server.CreateObject("Persits.Upload.1")

Upload.OverwriteFiles = False
On Error Resume Next

Upload.SetMaxSize 1048576 ' Limit files to 1MB
Count = Upload.SaveVirtual ("\imageuploads\")


%>

How, using asp code, can I append the userid variable to the end of the upload path? I've tried

...
Count = Upload.SaveVirtual ("\imageuploads\<%=Request.Form("userid")%>")

but this doesn't work - I get this error:

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/uploadpost.asp, line 9

Count = Upload.SaveVirtual ("\imageuploads\<%=Request.Form("userid")
-------------------------------------------------------------------^

I want the upload path to be : \imageuploads\1 for user 1, \imageuploads\2 for user 2 etc


I can see in DW that the Request.Formasp code isn't being recognised properly (presumably something to do with being within " ")

Can anyone point me in the right direction to try and get this working?

Thanks very much
This topic has been closed for replies.

1 reply

Inspiring
January 15, 2007

> ...
> Count = Upload.SaveVirtual
> ("\imageuploads\<%=Request.QueryString("userid")%>")
>

You're already in a server-side block. They can't be nested. Also, only
string literals should be inside "", never variables.

Count = Upload.SaveVirtual ("\imageuploads\" &
Request.QueryString("userid"))