Okay, first the hashing. From what I've read I have to open it in binary mode. If I try just using the fileitem from the instance the script complains that the data must be in a string or read-only binary. I've tried to again open the file for obtaining the hash value but it doesn't work and even if it did it seems that it would be rather inefficient to hash after testing to see if the file was uploaded. Can the hashing not occur as the file is being read into buffer or written to the file-system?
Main Topics
Browse All Topics





by: cxrPosted on 2009-10-15 at 17:36:18ID: 25586141
1. Use the function os.path.isfile() to check if the file exists. Use os.rename() to rename the old file.
t()
/path/page ">link</a>
2. You can use the standard hashlib module:
import hashlib
hexdigest = hashlib.md5(data).hexdiges
datalength = len(data)
"data" in the example is the content of the file.
3. Make a link by writing the following HTML into the 'message' variable:
<a href="http://thedomain.com
If the link is to the same domain as the current page, you can omit the domain name:
<a href="/path/page">link</a>
...and if it is in the same path, you can also omit the path:
<a href="page">link</a>