file uploader
Sick Monkey
sickcodemonkey at gmail.com
Wed May 9 21:49:59 EDT 2007
Hey guys. I wanted to write a little desktop application that would upload
files to an external server, to a specific directory.
The desktop application is running on Mac OS X and I built a .psp script
that is running on a Red Hat server.
NOTE: This application is written for Python 2.5 (both py and psp)
My code is giving me problems, in that it is overwriting files. I was
wondering if anyone knew of a module or a method that would overcome this
dilemma. I can adapt my program to search to see if the file existed
already in the directory and append a random string sequence to keep this
from occurring, but I do not want to reinvent the wheel (if such a thing
exists) and that would clutter up my program. :)
Here is what I am currently using:
fname = os.path.basename(uploadFile.filename)
dir_path = "/u01"
open(os.path.join(dir_path, fname), 'wb').write(uploadFile.file.read())
As always, any help is greatly appreciated.
.dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070509/79a8eba0/attachment.html>
More information about the Python-list
mailing list