I have the same problem. How did you sovle it?

On Saturday, January 15, 2011 8:56:41 AM UTC+8, Thomas Dall'Agnese wrote:
>
> Dear community, 
>
> I have a form with an upload field that I use to upload a text file, 
> parse information from this file and store this information into the 
> database, but not the file itself. 
>
> The form is for example defined by: 
> form = FORM(INPUT(_name='file_field', _type = 'file', requires = 
> IS_NOT_EMPTY()), 
>               INPUT(_type='submit')) 
>
> I can access the file content with request.vars.file_field.file.read() 
> but this function does not detect the file encoding and open all my 
> file as utf-8. 
> So instead I would like to use codecs.open(xxx, "r", charset) to 
> define the charset (utf-8, iso-8859-1, ...). 
> However, as I don't store the file, I can't find the file in the 
> uploads/ directory. 
> How can I find the temporary file path if there is any? 
>
> Or do you have any suggestion to read the uploaded file with the right 
> encoding (without chardet)? 
>
> Best regards, 
>
> $p00ky

Reply via email to