I got a piece of python script to upload file and it can upload it to
different folders on server depend on the type of file is image or not.
but I also want to restrict the size and dimensions of file if it is a
image file.Could anyone help me out?
Parameter List:id, file, title='',folder
REQUEST=context .REQUEST
content_type=fi le.headers['Content-Type']
if content_type.fi nd('image')!=-1: #.find() is a method in Python2.0<
destination=con text.restricted Traverse('/cheng/rvdpas/uploadImage/'+folder)
destination.man age_addImage(id , file, title)\
else:
destination=con text.restricted Traverse('/cheng/rvdpas/uploadDocument/'+folder)
destination.man age_addFile(id, file, title)
return 'Finished'
different folders on server depend on the type of file is image or not.
but I also want to restrict the size and dimensions of file if it is a
image file.Could anyone help me out?
Parameter List:id, file, title='',folder
REQUEST=context .REQUEST
content_type=fi le.headers['Content-Type']
if content_type.fi nd('image')!=-1: #.find() is a method in Python2.0<
destination=con text.restricted Traverse('/cheng/rvdpas/uploadImage/'+folder)
destination.man age_addImage(id , file, title)\
else:
destination=con text.restricted Traverse('/cheng/rvdpas/uploadDocument/'+folder)
destination.man age_addFile(id, file, title)
return 'Finished'
Comment