Home > database >  Document written in the book of the IIS server, but cannot download.
Document written in the book of the IIS server, but cannot download.

Time:10-16

 # IF DEFINED PBWEBFORM THEN 
Ls_docname="c: \ temp " + string (today (), 'YYMMDD) +' _ '+ string (now (),' HHmmSS) + ". TXT "
Ll_value=https://bbs.csdn.net/topics/1
# the ELSE
Ls_cur_path=space (256)
Getcurrentdirectorya (256, ls_cur_path)
Ll_value=https://bbs.csdn.net/topics/getfilesavename (" the export file, "ls_docname ls_named," TXT ", "text file (*.txt), *. TXT")
If ll_value=https://bbs.csdn.net/topics/1 then
Setcurrentdirectorya (ls_cur_path)
End the if

If fileexists (ls_docname) then
If messagebox (' prompt ', ls_named + 'file already exists, the need to cover? ', the Exclamation! YesNo! , 2)=2 then return
Filedelete (ls_docname)
End the if
# END IF

Ll_value=https://bbs.csdn.net/topics/FileOpen (ls_docname LineMode! The Write! , LockWrite! , Append!)
For ll=1 to dw_list. Rowcount ()
If dw_list. Getitemnumber (1, 'flag')=0 then the continue
Ls_str=dw_arg. Getitemstring (1, 'code')
Ls_str +=', '
Ls_str +=dw_list. Getitemstring (ll 'invo_no)
Ls_str +=', '
Ls_total=dw_list. Getitemstring (ll 'total')
If pos (ls_total, '00') & gt; 0 then ls_total=string (long (ls_total))
Ls_str +=ls_total
Ls_str +=', '
Ls_str +=string (date (dw_list getitemstring (ll 'invo_date)),' - dd yyyy - mm)
Ls_str +='~ r'
Filewrite (ll_value ls_str)
Next


# IF DEFINED PBWEBFORM THEN
Fileclose (ll_value)
String s=GetDownloadFileUrl (ls_docname, false)
Long ll_=URLDownloadToFile (0, s, ls_docname, 0, 0)
If URLDownloadToFile (0, s, ls_docname, 0, 0) & gt; 0 then messagebox (' prompt ', 'file:' + ls_docname + 'has been exported,')
# the ELSE
If fileclose (ll_value)=1 then messagebox (' prompt ', 'export completed,')
# END IF


How also can not download, is GetDownloadFileUrl method is to use a wrong?

CodePudding user response:

Use IE can try the link to download,

See what prompts, such as enough permissions, such as

Some time, may also be only the file type is not to download, change the IIS Settings,

CodePudding user response:

Estimate was caused by a virtual directory, section of the code I wrote to you, you consult



 

Long ll_row, ll_value
String ls_suffix
Ll_row=dw_main. Getrow ()
If ll_row & lt;=0 then
Return
End the if

String ls_file ls_url, ls_path
String ls_name="ZGSZH", ls_net="zg_gctos
"Ll_value=https://bbs.csdn.net/topics/dw_main.getitemnumber (ll_row, "filevalue")
Ls_suffix=dw_main. Getitemstring (ll_row, "filesuffix")
Ls_file="myfile" + string (now (), "HHMMSS") + "" + ls_suffix
Saveastype lenu_data ld_data []

Ld_data [1]=Excel!
Ld_data [2]=Text!
Ld_data [3]=CSV!
Ld_data [4]=SYLK!
Ld_data [5]=WKS!
Ld_data [6]=WK1!
Ld_data [7]=DIF!
Ld_data [8]=dBASE2!
Ld_data [9]=dBASE3!
Ld_data [10]=SQLInsert!
Ld_data [11]=Clipboard!
Ld_data [12]=PSReport!
Ld_data [13]=WMF!
Ld_data [14]=HTMLTable!
Ld_data [15]=Excel5!
Ld_data [16]=XML!
Ld_data [17]=XSLFO!
Ld_data [18]=PDF!
Ld_data [19]=Excel8!
Ld_data [20]=EMF!
Ld_data [25]=XLSX!
Ld_data [26]=XLSB!

Lenu_data=https://bbs.csdn.net/topics/ld_data [ll_value + 1]

# IF DEFINED PBWEBFORM THEN
If idw_data. SaveAs (ls_file lenu_data, true) & lt;> 1 then
Ls_url=System. Web. HttpContext. Current. Request. Url. The tostring ()
Ls_path=MapVirtualPath (ls_file)

Long ll_pos, ll_next
Ll_pos=pos (ls_name ls_url, "/" + + "/")
If ll_pos & gt; 0 then
Ls_url=left (ls_url ll_pos - 1) + "/"

Ll_next=pos (ls_path, ls_net + "_root")
If ll_next & gt; 0 then
Ls_url +=mid (ls_path ll_next)

Ll_pos=pos (ls_url, '\')
The do while ll_pos & gt; 0
Ls_url=left (ls_url ll_pos - 1) + '/' + mid (ls_url, ll_pos + 1)
Ll_pos=pos (ls_url, '\')
Loop
Shl_1. Url=ls_url
End the if
End the if

Ls_file=GetDownloadFileUrl (ls_file, false)
Shl_2. Url=ls_file

Shl_1. Visible=true
Shl_2. Visible=true
End the if
# the ELSE
Idw_data. SaveAs (ls_file lenu_data, true)
# END IF

  • Related