
February 18th, 2003, 04:48 PM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Uploading a file
Hi people Im trying to upload a file this way:
[...]
if form.has_key("filename"):
item = form["filename"]
if item.file:
outp = open("uploaded/file.tmp","w")
data = item.file.read()
outp.write(data)
outp.close()
print "Content-type:text/html\n\n"
print form["filename"].filename
It works now I can improve it by creating random file names (to avoid multiple users accessing the same file) and then I can get the original file name by using os.path stuff but... is there not any way to upload a file different than this? Cant I move the file from the tmp or something? any other way? thanks in advance
|