Upload file from C# Windows Application to PHP Web form in Apache Server

  • Thread starter Thread starter Daniel López
  • Start date Start date
D

Daniel López

Anyone know how can I upload a file to a PHP Web Form from a C# Windows
Application ?

I've tried to use
WebClient.UploadFile("path_file_to_upload","url_of_php_form"); but with this
I don't upload anything and don't get any error. I think that the problem
should be in the php web form or in the way that I upload the file.

Thanks.
 
If you are assuming that the UploadFile method is going to somehow post a form
that contains a File upload input type, then that would be the disconnect.
UploadFile
simply sends the bytes in the file directly to the web page. In your PHP page,
you'll
need to read the request stream and that will be the file being uploaded.
Again, if
you expected this to somehow link up with a file input field then that isn't
going to
happen.
 
Can you send me an example code of both parts, please ?

I'm lost in php scripting :(

Regards...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top