The following works for me
set response header("Content-Disposition";"attachment;filename="+filename
of($docpath))
$extension:=extension of($docpath)
case of
:($extension=".doc")
write blob(vBlob;$extension)
:($extension=".pdf")
write blob(vBlob;$extension)
:($extension=".ppt")
write blob(vBlob;$extension)
else
$contenttype:="application/octet-stream"
set content type($contenttype)
write (vBlob)
end case
--
Cheers,
Ian
>
>>
>> Please see the mailing list archive for a discussion of the solution to
>> this:
>>
>> http://www.mail-archive.com/[email protected]/
>> msg00701.html
>>
> After following the above link I came up with my getdocument.a4p as follows
>
> <%
>
> C_TEXT($vDocName) `passed as query param
>
> C_TEXT($vIndex) `passed as query param
> `
> `
> `
> $docpath:=WW_GetDocPath(num($vIndex))
>
> C_BLOB($vBlobDownload)
> `
> `
> `
> $vResult:=WW_DocumentToBlob($docpath) `if successful created a blob
> called "vBlob"
> `
> case of
> :($vResult="BlobCreated")
>
> set response header("Content-Disposition";"attachment;
> filename="+filename of($docpath))
>
> case of
> :(extension of($docpath)=".doc") `word document
> set content type("application/vnd.ms-word")
>
> :(extension of($docpath)=".pdf") `pdf
> set content type("application/pdf")
>
> :(extension of($docpath)=".ppt") `powerpoint
> set content type("application/vnd.ms-powerpoint")
> else
> set content type("application/octet-stream")
> end case
>
> write (vBlob)
>
> :($vResult="ErrorConverting")
> write("<html><b>Error trying to convert file to blob for
> sending.</b></html>")
> :($vResult="ErrorLocating")
> write("<html><b>Error trying to find or open file:</b> "+filename
> of($docpath)+"</html>")
> else
> write("<html><b>Unknown error during file retrieval/sending
> process.</b></html>")
> end case
>
> %>
>
> This correctly downloads the files and they can be saved as say word
> documents. However Word cannot open the documents.
>
> Any ideas.
>
> Cheers,
> Kevin
>
>
>
>
>
>
> _______________________________________________
> Active4D-dev mailing list
> [email protected]
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/