Downloading a file form a displayed table
Dave Angel
davea at davea.name
Tue Mar 5 04:45:09 EST 2013
On 03/05/2013 04:00 AM, Νίκος Γκρ33κ wrote:
> # =================================================================================================================
> # display download button for each file and downlaod it on click
> # =================================================================================================================
> if form.getvalue('show') == 'files':
>
> print ( "<center><a href='http://superhost.gr/files.html'> <img src='/data/images/download.png'></a><br>" )
> print ( "<table border=5 cellpadding=5 bgcolor=blue>" )
>
> path = "/data/files/"
>
> for filename in os.walk(path):
> print '''
> <form method="get" action="%s">
> print( "<tr><td><center> <button type='submit'> %s </button> </td></tr>" ) % filename
> </form>
> '''
>
> sys.exit(0)
>
> ========================
>
> I use the above code to tidplay a filenames table so the user cna download a displayed button style lookign file but its not printing anything for me just an emptry table
>
> '/data/files' has 5 files in it but its not showing any.
> I dont see what iam doign wrong
>
It would be useful to actually specifying the context of this fragment
of code. Presumably it's running on a web server somewhere, and you're
expecting the filenames to somehow show up on a browser. Which OS and
which version of Python for that server, and what brand and version of
browser?
Have you considered closing the table, and ending the body of the page?
Have you looked at the result with View->Source in your browser?
--
DaveA
More information about the Python-list
mailing list