473,408 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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

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.
Nov 16 '05 #1
2 9695
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.
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Daniel López" <da************@yahoo.es> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl...
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.

Nov 16 '05 #2
Can you send me an example code of both parts, please ?

I'm lost in php scripting :(

Regards...

"Justin Rogers" <Ju****@games4dotnet.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
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.
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Daniel López" <da************@yahoo.es> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl...
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.


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
16
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
3
acoder
by: acoder | last post by:
How to Upload a File in Coldfusion Use the cffile tag for uploading files to the server. Note that allowing people to upload files is fraught with danger and only trusted users should be...
6
by: =?ISO-8859-1?Q?J=F8rn?= Dahl-Stamnes | last post by:
I have a strange problem when uploading a PDF document to a web-server. When I try this to a web-server running Apache 2 on a FC 4, it fails. Firefox says that the document contain no data. If I...
1
by: wbsurfver | last post by:
I'm trying to figure out why I can't upload a file in php. I'm trying it locally on a windows XP machine running Apache 2.2 and PHP 5.2.1. That is I am running the browser/server on same machine...
24
by: owz2008 | last post by:
This has probably been covered before but could not find a similar thread. Basically I have created a form which can be viewed at www.icomworks.co.uk/canvaspayform.html I want to submit the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.