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.

Recommended Answers

All 5 Replies

Be more specific about your problem. Are you working with php or c#?

Member Avatar for kohkohkoh

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 :(

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

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

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();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.