curl have win32 too :D

On Thu, Nov 13, 2008 at 9:28 PM, Timothy Farrell <[EMAIL PROTECTED]> wrote:

>  /timbo pulls out his stick of non-portable code and beats Phyo with it.
>
>
> Phyo Arkar wrote:
>
> No More need to Reinvent the wheel and it just works :)
>
> On Thu, Nov 13, 2008 at 9:18 PM, Phyo Arkar <[EMAIL PROTECTED]>wrote:
>
>> In spirit of Dont Repeat Yourself And to avoid Copy Pasting :
>>
>>  os.popen('curl -F "[EMAIL PROTECTED]" -F "[EMAIL PROTECTED]" -F "type=%s" 
>> -F "subgenre=%s" "
>> http://127.0.0.1:81/ultest/uploader.php";' %
>> (torrentfile,nfofile,subgenre,type) )
>>
>> This does the best trick :D
>>
>>
>>
>> On Thu, Nov 13, 2008 at 9:05 PM, mdipierro <[EMAIL PROTECTED]>wrote:
>>
>>>
>>> makes sense. Let us know if the script above does the trick.
>>>
>>> Massimo
>>>
>>> On Nov 13, 2:49 pm, "Phyo Arkar" <[EMAIL PROTECTED]> wrote:
>>> > Acutally , I am building a file upload script :D Which automaticlaly
>>> files
>>> > to a mirrored server via http.
>>> >
>>>  > On Thu, Nov 13, 2008 at 7:56 PM, Yarko T <[EMAIL PROTECTED]> wrote:
>>> > > Phyo is trying to build a bot!  ;-)
>>> >
>>>  > > On Thu, Nov 13, 2008 at 1:45 PM, Phyo Arkar <
>>> [EMAIL PROTECTED]>wrote:
>>> >
>>> > >> Dear Ceej
>>> >
>>> > >> I would like to upload to a form , from a python script. (Client
>>> side)
>>> >
>>> > >> Web2py do no thave upload (as client) rite?
>>> >
>>> > >> Thanks for reply anyways.
>>> >
>>> > >> Regards,
>>> >
>>> > >> Phyo.
>>> >
>>>  > >> On Thu, Nov 13, 2008 at 7:15 PM, ceej <[EMAIL PROTECTED]>
>>> wrote:
>>> >
>>> > >>> Phyo,
>>> >
>>> > >>> To get the data from the form that's submitted you can to
>>> > >>> request.vars.file.file.read():
>>> >
>>> > >>> And to write it to uploads you can do something like
>>> >
>>> > >>>              _folder='%(folder)suploads/'%{'folder':
>>> request.folder}
>>> > >>>              main_token=md5.new(str(datetime.datetime.now
>>> > >>> ())).hexdigest()
>>> > >>>              if not os.path.exists(_folder):
>>> > >>>                 os.makedirs('%sfile'%(_folder))
>>> > >>>              file = open('%syou_can_make_a_name.jpg'%(_folder),
>>> 'wb')
>>> > >>>              file.write(request.vars.file.file.read())
>>> > >>>              file.close
>>> >
>>> > >>> On Nov 13, 10:33 am, "Phyo Arkar" <[EMAIL PROTECTED]>
>>> wrote:
>>> > >>> > Dear All;
>>> >
>>> > >>> > How can i upload multipart form data files in python (web2py?)
>>> >
>>> > >>> > I cannot do it with
>>> >
>>> > >>> > urllib.urlencode
>>> > >>> > urllib2.urlopen(url,data)
>>> >
>>> > >>> > Files will not be uploaded , just urls will b posted ..(server
>>> backend
>>> > >>> is
>>> > >>> > php)
>>> >
>>> > >>> > def upload(torrentfile,nfofile,subgenre='Minimal',type=10):
>>> > >>> >     nfo_file=file(nfofile)
>>> > >>> >     torrent_file=file(torrentfile)
>>> > >>> >     data = {'nfo': nfo_file,
>>> > >>> >             'desc': "",
>>> > >>> >             'file':  torrent_file,
>>> > >>> >             'type': type,
>>> > >>> >             'subgenre' : subgenre
>>> > >>> >             }
>>> > >>> >     uldata =urllib.urlencode(data)
>>> > >>> >     req = urllib2.Request(upload_url,uldata)
>>> > >>> >     resp = urllib2.urlopen(req)
>>> > >>> >     result = resp.read()
>>> > >>> >     print result
>>>
>>>
>>
>
>
>
> --
> Timothy Farrell <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
> Computer Guy
> Statewide General Insurance Agency (www.swgen.com)
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to