Progress bar in web-based ftp?

C

CatDude

I've got an application that prompts the user to select a file from his
local computer, checks the user's selection, then sends the file via
<form name="clients" method="POST" action="upload"
enctype="multipart/form-data">

In the python code that receives the files I've got a section that does
the following:

if not os.path.isfile(filePath):
file(filePath, 'wb').write(str(form[name].value))
else:
print "File already exists - deleting"
os.unlink(filePath)
file(filePath, 'wb').write(str(form[name].value))

after error checking, etc.

My question is whether anyone has ideas as to how I could implement a
progress bar. When I send a large file this way it can take a long time,
and I'd like to be able to reassure the user that something really is
happening.
 
L

Larry Bates

CatDude said:
I've got an application that prompts the user to select a file from his
local computer, checks the user's selection, then sends the file via
<form name="clients" method="POST" action="upload"
enctype="multipart/form-data">

In the python code that receives the files I've got a section that does
the following:

if not os.path.isfile(filePath):
file(filePath, 'wb').write(str(form[name].value))
else:
print "File already exists - deleting"
os.unlink(filePath)
file(filePath, 'wb').write(str(form[name].value))

after error checking, etc.

My question is whether anyone has ideas as to how I could implement a
progress bar. When I send a large file this way it can take a long time,
and I'd like to be able to reassure the user that something really is
happening.
Turns out that this is more difficult than you might think. The problem
is you must have the client communicate with the server in some way and
have the server know what the progress is at any point. HTML POST
action=upload doesn't give you anything to work with to provide such
information to the client's browser (if it does I'm not aware of it
anyway). It also would take something like JavaScript and XMLRPC on
the client to make the round trip to get updated progress information.

-Larry Bates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top