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

Issue with ASP and quotes

New Here ,
Aug 21, 2007 Aug 21, 2007
I am trying to copy an uploaded document from one directory to another. The uploaded file (attach1) will be dynamically named. The resulting file (LName) name is based on a last name field. I have the following code but I cannot figure out how to deal with the issue of quotation marks. Should I escape them or do I use another method?
TOPICS
Server side applications
299
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 ,
Aug 21, 2007 Aug 21, 2007
You should definitely change the code to something like this

dim fs, loadfile, movefile
loadfile = "E:\Inetpub\wwwroot\uploads\" &
frmSend.Fields.Item("attach1").Value & ".doc"
movefile = "E:\Inetpub\wwwroot\uploads\named\" &
frmSend.Fields.Item("LName").Value & ".doc"
set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.MoveFile loadfile,movefile
set fs=nothing



--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"ihsutd" <webforumsuser@macromedia.com> wrote in message
news:faes3c$sca$1@forums.macromedia.com...
>I am trying to copy an uploaded document from one directory to another. The
> uploaded file (attach1) will be dynamically named. The resulting file
> (LName)
> name is based on a last name field. I have the following code but I cannot
> figure out how to deal with the issue of quotation marks. Should I escape
> them
> or do I use another method?
>
>
> dim fs
> set fs=Server.CreateObject("Scripting.FileSystemObject")
> fs.MoveFile
> "E:\Inetpub\wwwroot\uploads\<%=(frmSend.Fields.Item("attach1").Value)%>.doc","E:
> \Inetpub\wwwroot\uploads\named\<%=(frmSend.Fields.Item("LName").Value)%>.doc"
> set fs=nothing
>


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
New Here ,
Aug 22, 2007 Aug 22, 2007
That seems like it will do the trick. When I try that code I get an error

Variable is undefined: 'frmSend'

Do I need to define that variable at some point? I assumed the frmSend being the form name would suffice.
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 ,
Aug 22, 2007 Aug 22, 2007
LATEST
The code block would need to go after the recordset had been created which
will define the name of that variable.

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"ihsutd" <webforumsuser@macromedia.com> wrote in message
news:faheo8$tk$1@forums.macromedia.com...
> That seems like it will do the trick. When I try that code I get an error
>
> Variable is undefined: 'frmSend'
>
> Do I need to define that variable at some point? I assumed the frmSend
> being
> the form name would suffice.
>


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