X Tutup
#!/usr/bin/env python # -*- coding: UTF-8 -*- # enable debugging import cgitb import cgi cgitb.enable() import urllib import os import shutil import sys print "Content-Type: text/html" print form = cgi.FieldStorage() link = form.getvalue("link") usun = form.getvalue("usun") name = form.getvalue("name") fileName = form.getvalue("fileName") print "
" if link <= 0: print """
Link:

File name:


""" print "Uploaded files:
" uploaded = os.listdir('/var/www/downloads') for i in range(len(uploaded)): path = os.path.abspath(uploaded[i]) print "
%s
" % (uploaded[i], uploaded[i]) if usun > 0: if os.path.exists('/var/www/downloads/'+usun): os.remove('/var/www/downloads/'+usun) print "" else: print "Downloading...
%s" % link try: link_open = urllib.FancyURLopener() plik = link_open.retrieve(link) except Exception as blad: print blad try: location = os.path.abspath('/var/www/downloads/') if fileName > 0: shutil.move(plik[0], location+"/"+fileName) print "
File moved to
%s" % location+"/"+fileName else: shutil.move(plik[0], location) print "
File moved to
%s" % location except Exception as blad2: print blad2 else: print "
Done!
" print "GO BACK"
X Tutup