I wish there was a python equivalent to the linux "file" command. That thing rocks.
Since my web2py runs on a linux server, I just fork the process over to the command line to verify the files, and then parse the output, and life is good. -Thadeus On Tue, Nov 24, 2009 at 5:53 PM, Richard <richar...@gmail.com> wrote: > > no not a guarantee, but would it be worth adding anyway? > > > On Nov 24, 4:10 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > Unfortunately checking the mime type is no guarantee that the file > > format is conform to specs. > > > > On Nov 23, 7:49 pm, Richard <richar...@gmail.com> wrote: > > > > > could a new validator be added to check the mime type from the POSTed > > > content-type? > > > IS_MIME_TYPE('png') > > > > > Django has something like this: > http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > > > > Richard > > > > > On Nov 23, 2:50 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > > > > This is for uploaded plug-ins (for plugincentral). > > > > > > I want to make sure they are actually tarred archives with python > code in > > > > them. I need to check the actual file contents instead of just the > filename > > > > (which gets checked first, to make sure it is "web2py.plugin.*.w2p" > > > > > > -Thadeus > > > > > > On Sun, Nov 22, 2009 at 9:46 PM, mdipierro <mdipie...@cs.depaul.edu> > wrote: > > > > > > > There a IS_IMAGE that can check for BMP, GIF, JPEG, and PNG. > > > > > You can copy and modify it to check for other formats. > > > > > What formats are you thinking about? > > > > > > > On Nov 22, 9:41 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > > > > Is there a way, through SQLFORM to open a file, and make sure it > is the > > > > > kind > > > > > > of file you are expecting. > > > > > > > > I would like to check to see if the files users are uploading, > are indeed > > > > > > w2p tarred files with only .py files with a naming scheme in > them. > > > > > > > > I know I could use SQLFORM.factory and then open the file after > it is > > > > > saved > > > > > > to the server, then delete it if it was no good, I was just > wondering if > > > > > > there was a way to "hook" into the validation. > > > > > > > > -Thadeus > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---