Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

asp question

New Here ,
Jan 15, 2007 Jan 15, 2007
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
TOPICS
Server side applications
276
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 15, 2007 Jan 15, 2007
LATEST

> ...
> 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"))


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines