I was able to send a txt file by having these 2 variables storing header...
static TCHAR hdrs[] = "Content-Type: multipart/form-data; boundary=---------------------------7d82751e2bc0858";
sprintf(frmdata,"-----------------------------7d82751e2bc0858\r\nContent-Disposition: form-data; name=\"uploaded_file\";filename=\"%s\"\r\nContent-Type:application/octet-stream\r\n\r\n",temp_upload_data->file_name);
I am adding txt file data to frmdata variable at its end.i am opening txt file in read mode. and i am using this function to send request
sent= HttpSendRequest(hRequest, hdrs, strlen(hdrs), frmdata, strlen(frmdata));
by this i am able to upload a txt file.. now i want to upload a zip file... I need some help on how to do this... thnx in advance...
Use
HttpSendRequestEx
and something like :Then use
InternetWriteFile
andHttpEndRequest
to send the request. Also note you have to callHttpOpenRequest
with POST.This some codes work for me
First the header parts:
and main codes below...most is between sending the
head[]
andtail[]
yousend(write)
the data.I had removed error checking and codes from
InternetOpen()
toHttpOpenRequest()
for they were known in otherWinINet
examples:About the php codes to get 'userfile', please ref to php's example Example #2 Validating file uploads
Hope it helps