0

Hey guys im having a little problem with this project im working on basically im making a desktop image uploader for this site http://www.noelshack.com/api.php i have tried hacking around with some example code but cant get anything working i cant even check if the images are uploaded correctly because when i try to get a repsonse from the script i just get the code of the script itself, anyway can any body help me out.

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by killerdoob
0

I myself also experiencing the similar issue., still looking for solution.

Trying to build an application to upload afile and save into the respective url .

i at my wits end too!
my problem:
i tried to convert to bytes and post to the url(my url).
but whatever captures in the url, i cant convert it back to file...it seems the bytes are different. the webpage that i am using is lotus domino. using java on top of that.

i also hoping you guys who had experience of the work around could help us..
thank you :(

0

im working in c# im just trying to interface with a php page.
anybody have any ideas?

0

You need to show effort, and what better way than posting the code that you have tried so far?

0

Here my code for uploading the image from my form, any help is appreciated

WebRequest request = WebRequest.Create("http://www.noelshack.com/api.php");
            request.Method = "POST";

            byte[] byteArray = imageToByteArray(Image.FromFile(pathLabel.Text), ImageFormat.Png);
            
            request.ContentType = "multipart/form-data";
            request.ContentLength = byteArray.Length;
            Stream dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();
            WebResponse response = request.GetResponse();
            MessageBox.Show(((HttpWebResponse)response).StatusDescription);
            dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();
            MessageBox.Show(responseFromServer);
            reader.Close();
            dataStream.Close();
            response.Close();

Edited by killerdoob: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.