folletxavier
asked on
File upload
Hi!
I'ld need to know how my client app could upload files to a HTTP server through port 80.
Do you have any idea?
Thanks
/Xavier
I'ld need to know how my client app could upload files to a HTTP server through port 80.
Do you have any idea?
Thanks
/Xavier
ASKER
Yes, that's right...
I've come a bit farther since yesterday;
I create a client form
<FORM NAME="oForm" ACTION="/scripts/cpshost.d ll?PUBLISH ?/scripts/ repost.asp " ENCTYPE="multipart/form-da ta" METHOD="post">
<INPUT TYPE="file" NAME="oFile1">
...
</FORM>
Where cpshost.dll is a Microsoft server DLL that copies the file to disk(on the server).
The problem that is left is how to send this HTTP request by code?
I've come a bit farther since yesterday;
I create a client form
<FORM NAME="oForm" ACTION="/scripts/cpshost.d
<INPUT TYPE="file" NAME="oFile1">
...
</FORM>
Where cpshost.dll is a Microsoft server DLL that copies the file to disk(on the server).
The problem that is left is how to send this HTTP request by code?
Because the main-functionality already exists using the html input type=text I suggest you do something with the WebBrowser control. It does not have to be visible to the user though. Once you have the control in memory, you can write just one simple form (as above in your post) to the webbrowser. Then you fill in the value of the input type=file using the reference to the webbrowser. Since all is ran on the client you can do that pretty easy. Then you use the javascript's submit function to submit the form to the server.
Some VB code (I have no idea which language you are using).
Create a reference to the Microsoft Internet Controls, and place the component on the form. Make sure it is invisible.
Private Sub Form_Load()
Me.WebBrowser1.NavigateTo "about:blank"
End Sub
Private Sub WebBrowser1_DocumentComple te( ... )
If webbrowser1.location="abou t:blank" then
webbrowser1.document.write "yourhtmlcodehere"
webbrowser1.document.close
webbrowser1.document.oForm .oFile1.va lue="c:\my file.txt"
webbrowser1.document.oForm .submit
End If
End Sub
Code has not been tested, but I hope the idea is clear :-/
Regards,
CJ
Some VB code (I have no idea which language you are using).
Create a reference to the Microsoft Internet Controls, and place the component on the form. Make sure it is invisible.
Private Sub Form_Load()
Me.WebBrowser1.NavigateTo "about:blank"
End Sub
Private Sub WebBrowser1_DocumentComple
If webbrowser1.location="abou
webbrowser1.document.write
webbrowser1.document.close
webbrowser1.document.oForm
webbrowser1.document.oForm
End If
End Sub
Code has not been tested, but I hope the idea is clear :-/
Regards,
CJ
ASKER
CJ_S:
Thanks for the very nice fix but using the webbrowser control is unfortunately not an option in my application... Inet or even better WINAPI are the only alternative I am given.
/Xavier
Thanks for the very nice fix but using the webbrowser control is unfortunately not an option in my application... Inet or even better WINAPI are the only alternative I am given.
/Xavier
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Regards,
CJ