On Thursday, October 20, 2011 3:57:24 PM UTC-4, apple wrote:
>
> I am now experimenting with uploading files to the database but have 
> not been successful and have some questions: 
>
> 1) Field('file','upload', uploadfield='fileblob'), 
>
> I understand this is supposed to create the fileblob field 
> automatically. However it does not seem to do this for me. Does it not 
> work with sqlite? 
>

I don't think it's supposed to be automatic -- I think you're supposed to 
define the uploadfield explicitly.
 

>
> 2) I have added fileblob to my model explicitly and when i display a 
> SQLFORM it displays a button and lets me choose a file. However when I 
> submit then the record is redisplayed and the file does not seem to be 
> shown nor is it in the database. I don't see what I am doing wrong. Is 
> there an example somewhere that shows file uploads to the database 
> working? 
>

See http://web2py.com/book/default/chapter/11#Upload-Files-in-Database.
 

>
> 3) If I use a custom form which loops through form.custom.label then 
> it fails at self.custom.widget["fileblob"] saying it is a key error. 
> Do I have to explicitly miss out the fileblob fields within my custom 
> table?


The 'fileblob' field doesn't get a widget -- just the 'file' field does. The 
'file' field is the upload field, so it gets displayed in the form. The 
'fileblob' field is just used to store the file so doesn't need to get 
displayed in the form.
 

Reply via email to