News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

What is wrong with my code

Started by Farabi, April 02, 2009, 01:33:08 PM

Previous topic - Next topic

Farabi

Im reading from Microsoft website a tutorial which is telling me how to upload a file to webserver.
here is the code


.data
FrmData db "Content-Disposition: form-data; name=",022h,"uploadedfile",022h,"; filename=",022h,"fMath.inc",022h,13,10
FrmData2 db "Content-Type: text/plain",13,10
FrmData3 db 13,10,"AAAAAAAAAA"
FrmData4 db 13,10,"boundary=---------------------------7d82751e2bc0858",0
FrmData5 db 0

.code

fInetUpload proc uses esi edi
LOCAL hOpen,hCon,hReq,brcv:dword
LOCAL filesz,mem_handle:dword
LOCAL buff[256]:dword

invoke InternetOpen,CADD("Farabi"),INTERNET_OPEN_TYPE_PRECONFIG,0,0,0
mov hOpen,eax
.if eax==0
invoke MessageBox,0,CADD("InternetOpen Failed"),0,0
invoke PostQuitMessage,0
.endif
invoke InternetConnect,hOpen,CADD("antihack1221.awardspace.com"),INTERNET_DEFAULT_HTTP_PORT,0,0,INTERNET_SERVICE_HTTP,0,1
.if eax==0
invoke MessageBox,0,CADD("InternetConnect"),0,0
.endif
mov hCon,eax
invoke HttpOpenRequest,hCon,CADD("Post"),CADD("uploader2.php"),CADD("HTTP/1.0"),0,0,0,1
.if eax==0
invoke MessageBox,0,CADD("HttpOpenRequest Failed"),0,0
.endif
mov hReq,eax

lea edx,FrmData5
lea eax,FrmData
sub edx,eax
push edx
invoke dw2a,edx,addr buff
invoke MessageBox,0,addr buff,0,MB_OK
pop edx
invoke HttpSendRequest,hReq,addr hRequest,sizeof hRequest,addr FrmData,edx
.if eax==0
invoke PERR
.endif

invoke InternetCloseHandle,hCon
invoke InternetCloseHandle,hOpen
invoke InternetCloseHandle,hReq



ret
fInetUpload endp


THere is no error message but it doesnot upload anything. I tried to made an form page and its work, so the problem seems not on the php page but on my code. Anyone know how to solve this?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

tetsu-jp


Farabi

Quote from: tetsu-jp on April 02, 2009, 03:33:42 PM
have you checked firewall

Does my code works?

Im checking firewall and my program is not listed.
Every time I run my application there are no windows firewall message.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"