Tags: django,tips

Sort by: Date / Title /

  1. 9 years ago by macks
    descragar y cambiar de nombre al archivo
    1. def downloadImage(self):
    2.     img_url = 'http://img1cdn.adoosimg.com/b195d543e38e349deac032b41be043c7-1-5.jpg'
    3.     imgName = 'b195d543e38e349deac032b41be043c7-1-5.jpg'
    4.     imgN = "peque_%s"%imgName.replace('5.','7.') if imgName[-5:]=='5.jpg' else imgName
    5.    
    6.     file_path = "%s/adoos/%s" % (settings.UPLOAD_PATH, imgN)
    7.     downloaded_image = file(file_path, "wb")
    8.  
    9.     image_on_web = urllib.urlopen(img_url)
    10.     while True:
    11.         buf = image_on_web.read(65536)
    12.         if len(buf) == 0:
    13.             break
    14.         downloaded_image.write(buf)
    15.     downloaded_image.close()
    16.     image_on_web.close()
    17.  
    18.     return  file_path
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2073"></script>
  2. 9 years ago by macks
    1. #form.cleaned_data['videoPath'] = C:Apacheuploadsvideosvideo_test.flv
    2.  
    3. path = form.cleaned_data['videoPath'].replace("\","/")
    4.             vName = ''.join(path.split("/")[-1:])
    5.  
    6. #result = 'video_test.flv'
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2045"></script>
  3. 9 years ago by macks
    1. #if simple
    2. u.is_activeTrue if is_active == 'on' else False
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2005"></script>
  4. sponsorised links

First / Previous / Next / Last / Page 1 of 1 (3 posteets)