Welcome to WebmasterWorld Guest from 54.167.216.93

Forum Moderators: phranque

Message Too Old, No Replies

Jpeg displaying as base64 string

When programaticallly posting a form

     
6:39 am on Jun 19, 2004 (gmt 0)

10+ Year Member



Hi

I'm programatically posting an image using multipart/form-data. It sends to the server OK, but when I try to view it in the browser, it is still in the base64 string I sent it as: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUG etc....

I've been through the form I built over and over:

string PostData = "";

PostData += "-----------------------------7d41fb3081216";
PostData += "\r";
PostData += "\n";

PostData += "Content-Disposition: form-data; name=\"userfile\"; filename=" + "\"c:\\temp\\" + "myimg.jpg\";";
PostData += "\r";
PostData += "\n";

PostData += "Content-Type: image/jpeg; name=\"myimg.jpg\";";
PostData += "\r";
PostData += "\n";

PostData +="Content-Transfer-Encoding: binary;";
PostData += "\r";
PostData += "\n";
PostData += "\r";
PostData += "\n";

string a = Convert.ToBase64String(imagefile); //imagefile is a byte array
PostData += a;

PostData += "\r";
PostData += "\n";

PostData += "-----------------------------7d41fb3081216--";

I've tried pretty much every order of mimes, but still the image isn't sent properly. Does anyone have any experience of this or what could be causing the base64 string to persist like that?

Thanks

 

Featured Threads

Hot Threads This Week

Hot Threads This Month